96
How to generate a random permutation in a permutation class? Fr´ ed´ erique Bassino (Laboratoire d’informatique de Paris Nord, Universit´ e Paris 13) talk based on joint works with M. Bouvel, V. Feray, L. Gerin, A. Pierrot, C. Pivoteau, D. Rossin Gascom, juin 2016 La Marana, Corse

How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

  • Upload
    others

  • View
    33

  • Download
    0

Embed Size (px)

Citation preview

Page 1: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

How to generate a random permutation in apermutation class?

Frederique Bassino(Laboratoire d’informatique de Paris Nord, Universite Paris 13)

talk based on joint works withM. Bouvel, V. Feray, L. Gerin, A. Pierrot, C. Pivoteau, D. Rossin

Gascom, juin 2016 La Marana, Corse

Page 2: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Combinatorial specifications and trees

Page 3: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Combinatorial specifications and their byproducts

[Flajolet & Sedgewick 09]

A combinatorial specification describes (most of the time, recursively) acombinatorial class C (= a family of discrete objects) by ways of atomsand admissible constructions, like disjoint union, product, sequence, . . .

Examples:

D = ε+uDdD ;

T = U + BU = •+

•B

B = ◦+◦U U

;

A1 = Φ1(A1,A2, . . . ,Ap)

A2 = Φ2(A1,A2, . . . ,Ap)

. . .

Ap = Φp(A1,A2, . . . ,Ap)

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 3 / 34

Page 4: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Combinatorial specifications and their byproducts

[Flajolet & Sedgewick 09]

A combinatorial specification describes (most of the time, recursively) acombinatorial class C (= a family of discrete objects) by ways of atomsand admissible constructions, like disjoint union, product, sequence, . . .

Examples:

D = ε+uDdD ;

T = U + BU = •+

•B

B = ◦+◦U U

;

A1 = Φ1(A1,A2, . . . ,Ap)

A2 = Φ2(A1,A2, . . . ,Ap)

. . .

Ap = Φp(A1,A2, . . . ,Ap)

Systematic transcription of an unambiguous specification into:

System of equations for the generating function C (z) =∑

cnzn

[Flajolet & Sedgewick 09]

Recursive [Flajolet, Zimmerman & Van Cutsem 94] and Boltzmannrandom samplers [Duchon, Flajolet, Louchard & Schaeffer 04]

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 3 / 34

Page 5: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Substitution decompositionand decomposition trees

Page 6: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Substitution decomposition of combinatorial objects

Combinatorial analogue of the decomposition of integers as products ofprimes. Applies to relations, graphs, posets, boolean functions, setsystems, . . . and permutations [Mohring & Radermacher 84]

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 5 / 34

Page 7: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Substitution decomposition of combinatorial objects

Combinatorial analogue of the decomposition of integers as products ofprimes. Applies to relations, graphs, posets, boolean functions, setsystems, . . . and permutations [Mohring & Radermacher 84]

Relies on:

a principle for building objects (permutations, graphs) from smallerobjects: the substitution

some “basic objects” for this construction: simple permutations,prime graphs

Required properties:

every object can be (recursively) decomposed using only “basicobjects”

this decomposition is unique

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 5 / 34

Page 8: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permutations

Permutation of size n = Bijection from [1..n] to itself.Set Sn, and S = ∪nSn.

Two lines notation:

σ =

(1 2 3 4 5 6 7 81 8 3 6 4 2 5 7

)Linear notation:σ = 1 8 3 6 4 2 5 7

Description as aproduct of cycles:σ = (1) (2 8 7 5 4 6) (3)

Graphical description,or diagram:

i

σi

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 6 / 34

Page 9: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Substitution for permutations

Substitution or inflation : σ = π[α(1), α(2), . . . , α(k)].

Example: Here, π = 1 3 2, and

α(1) = 2 1 =

α(2) = 1 3 2 =

α(3) = 1 =

.

Hence σ = 1 3 2[2 1, 1 3 2, 1] = 2 1 4 6 5 3.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 7 / 34

Page 10: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Simple permutations

Interval (or block) = set of elements of σ whosepositions and values form intervals of integersExample: 5 7 4 6 is an interval of 2 5 7 4 6 1 3

Simple permutation = permutation with nointerval, except the trivial ones: 1, 2, . . . , n and σExample: 3 1 7 4 6 2 5 is simple

Not simple:

Simple:

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 8 / 34

Page 11: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Simple permutations

Interval (or block) = set of elements of σ whosepositions and values form intervals of integersExample: 5 7 4 6 is an interval of 2 5 7 4 6 1 3

Simple permutation = permutation with nointerval, except the trivial ones: 1, 2, . . . , n and σExample: 3 1 7 4 6 2 5 is simple

The smallest simple permutations:12, 21, 2413, 3142, 6 of size 5, . . .Remark:It is convenient to consider 12 and 21 notsimple.

Not simple:

Simple:

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 8 / 34

Page 12: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Substitution decomposition theorem(s) for permutations

Theorem: [Albert, Atkinson & Klazar 03]

Every σ ( 6= 1) is uniquely decomposed as

12[α(1), α(2)] = ⊕[α(1), α(2)], where α(1) is ⊕-indecomposable

21[α(1), α(2)] = [α(1), α(2)], where α(1) is -indecomposable

π[α(1), . . . , α(k)], where π is simple of size k ≥ 4

Notations:

⊕-indecomposable: that cannot be written as ⊕[β(1), β(2)]

-indecomposable: that cannot be written as [β(1), β(2)]

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 9 / 34

Page 13: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Substitution decomposition theorem(s) for permutations

Theorem: [Albert, Atkinson & Klazar 03]

Every σ ( 6= 1) is uniquely decomposed as

12[α(1), α(2)] = ⊕[α(1), α(2)], where α(1) is ⊕-indecomposable

21[α(1), α(2)] = [α(1), α(2)], where α(1) is -indecomposable

π[α(1), . . . , α(k)], where π is simple of size k ≥ 4

Notations:

⊕-indecomposable: that cannot be written as ⊕[β(1), β(2)]

-indecomposable: that cannot be written as [β(1), β(2)]

Observation: Equivalently, we may replace the first two items by

12 . . . k[α(1), . . . , α(k)] = ⊕[α(1), . . . , α(k)], where the α(i) are ⊕-indecomposable

k . . . 21[α(1), . . . , α(k)] = [α(1), . . . , α(k)], where the α(i) are -indecomposable

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 9 / 34

Page 14: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Substitution decomposition theorem(s) for permutations

Theorem: [Albert, Atkinson & Klazar 03]

Every σ ( 6= 1) is uniquely decomposed as

12[α(1), α(2)] = ⊕[α(1), α(2)], where α(1) is ⊕-indecomposable

21[α(1), α(2)] = [α(1), α(2)], where α(1) is -indecomposable

π[α(1), . . . , α(k)], where π is simple of size k ≥ 4

Notations:

⊕-indecomposable: that cannot be written as ⊕[β(1), β(2)]

-indecomposable: that cannot be written as [β(1), β(2)]

Observation: Equivalently, we may replace the first two items by

12 . . . k[α(1), . . . , α(k)] = ⊕[α(1), . . . , α(k)], where the α(i) are ⊕-indecomposable

k . . . 21[α(1), . . . , α(k)] = [α(1), . . . , α(k)], where the α(i) are -indecomposable

Decomposing recursively inside the α(i) ⇒ decomposition tree

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 9 / 34

Page 15: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Decomposition tree: witness of this decomposition

Example: Decomposition tree ofσ = 10 13 12 11 14 1 18 19 20 21 17 16 15 4 8 3 2 9 5 6 7

3 1 4 2

2 4 1 5 3

Notations and properties:

• ⊕ = 12 . . . k , = k . . . 21= linear nodes.

• π simple of size ≥ 4= prime node.

• No edge ⊕−⊕ nor −.

• Rooted ordered trees.

• These conditions characterizedecomposition trees.

σ = 31 4 2[⊕[1,[1, 1, 1], 1], 1,[⊕[1, 1, 1, 1], 1, 1, 1], 2 4 1 5 3[1, 1,[1, 1], 1,⊕[1, 1, 1]]]

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 10 / 34

Page 16: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Decomposition tree: witness of this decomposition

Example: Decomposition tree ofσ = 10 13 12 11 14 1 18 19 20 21 17 16 15 4 8 3 2 9 5 6 7

3 1 4 2

2 4 1 5 3

Notations and properties:

• ⊕ = 12 . . . k , = k . . . 21= linear nodes.

• π simple of size ≥ 4= prime node.

• No edge ⊕−⊕ nor −.

• Rooted ordered trees.

• These conditions characterizedecomposition trees.

σ = 31 4 2[⊕[1,[1, 1, 1], 1], 1,[⊕[1, 1, 1, 1], 1, 1, 1], 2 4 1 5 3[1, 1,[1, 1], 1,⊕[1, 1, 1]]]

Observation: Adapts to binary case via⊕

T1 T2. . . Tk

7→ ⊕T1 ⊕

T2 ⊕. . . Tk

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 10 / 34

Page 17: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Decomposition tree: witness of this decomposition

Example: Decomposition tree ofσ = 10 13 12 11 14 1 18 19 20 21 17 16 15 4 8 3 2 9 5 6 7

3 1 4 2

2 4 1 5 3

Notations and properties:

• ⊕ = 12 . . . k , = k . . . 21= linear nodes.

• π simple of size ≥ 4= prime node.

• No edge ⊕−⊕ nor −.

• Rooted ordered trees.

• These conditions characterizedecomposition trees.

σ = 31 4 2[⊕[1,[1, 1, 1], 1], 1,[⊕[1, 1, 1, 1], 1, 1, 1], 2 4 1 5 3[1, 1,[1, 1], 1,⊕[1, 1, 1]]]

Bijection between permutations and their decomposition trees.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 10 / 34

Page 18: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Decomposition tree: witness of this decomposition

Example: Decomposition tree ofσ = 10 13 12 11 14 1 18 19 20 21 17 16 15 4 8 3 2 9 5 6 7

3 1 4 2

2 4 1 5 3

Notations and properties:

• ⊕ = 12 . . . k , = k . . . 21= linear nodes.

• π simple of size ≥ 4= prime node.

• No edge ⊕−⊕ nor −.

• Rooted ordered trees.

• These conditions characterizedecomposition trees.

σ = 31 4 2[⊕[1,[1, 1, 1], 1], 1,[⊕[1, 1, 1, 1], 1, 1, 1], 2 4 1 5 3[1, 1,[1, 1], 1,⊕[1, 1, 1]]]

Bijection between permutations and their decomposition trees.

Computation: Linear time algorithm [Uno & Yagiura 00] [Bui Xuan, Habib &

Paul 05] [Bergeron, Chauve, Montgolfier & Raffinot 08]

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 10 / 34

Page 19: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

A tree grammar for permutations

S denotes the set of simple permutations

S = •+⊕

S+ S+

S− S+

∑π∈S

π

S S . . . S

S+ = •+

S− S+

∑π∈S

π

S S . . . S

S− = •+⊕

S+ S+

∑π∈S

π

S S . . . S

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 11 / 34

Page 20: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

A tree grammar for permutations

S denotes the set of simple permutations, S(z) their generating function.

S = •+⊕

S+ S+

S− S+

∑π∈S

π

S S . . . S

S+ = •+

S− S+

∑π∈S

π

S S . . . S

S− = •+⊕

S+ S+

∑π∈S

π

S S . . . S

Allows to relate the (ordinary) generating function for simples with that ofall permutations (F (z) =

∑n!zn) [Albert, Atkinson & Klazar 03]:{

F (z) = z + 2I (z)F (z) + (S ◦ F )(z)

I (z) = z + I (z)F (z) + (S ◦ F )(z).

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 11 / 34

Page 21: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

A tree grammar for permutations

S denotes the set of simple permutations, S(z) their generating function.

S = •+⊕

S+ S+

S− S+

∑π∈S

π

S S . . . S

S+ = •+

S− S+

∑π∈S

π

S S . . . S

S− = •+⊕

S+ S+

∑π∈S

π

S S . . . S

Allows to relate the (ordinary) generating function for simples with that ofall permutations (F (z) =

∑n!zn) [Albert, Atkinson & Klazar 03]:{

F (z) = z + 2I (z)F (z) + (S ◦ F )(z)

I (z) = z + I (z)F (z) + (S ◦ F )(z).

Consequences for the enumeration of simple permutations:

Asymptotically n!e2

The generating function is not D-finite.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 11 / 34

Page 22: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

A tree grammar for permutations

S denotes the set of simple permutations, S(z) their generating function.

S = •+⊕

S+ S+

S− S+

∑π∈S

π

S S . . . S

S+ = •+

S− S+

∑π∈S

π

S S . . . S

S− = •+⊕

S+ S+

∑π∈S

π

S S . . . S

Can we specialize this tree grammar to subsets of S, and in particular topermutation classes C?

Can we do it automatically? even algorithmically?

Yes, when the number of simple permutations in C is finite.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 11 / 34

Page 23: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permutation patternsand permutation classes

Page 24: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permutation patterns

Pattern relation 4:π ∈ Sk is a pattern of σ ∈ Sn if ∃ 1 ≤ i1 < . . . < ik ≤ n such thatσi1 . . . σik is in the same relative order (≡) as π.

Notation: π 4 σ.

Equivalently:The normalization of σi1 . . . σik on[1..k] yields π.

Example: 2 1 3 4 4 3 1 2 8 5 4 7 9 6since 3 1 5 7 ≡ 2 1 3 4.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 13 / 34

Page 25: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permutation patterns

Pattern relation 4:π ∈ Sk is a pattern of σ ∈ Sn if ∃ 1 ≤ i1 < . . . < ik ≤ n such thatσi1 . . . σik is in the same relative order (≡) as π.

Notation: π 4 σ.

Equivalently:The normalization of σi1 . . . σik on[1..k] yields π.

Example: 2 1 3 4 4 3 1 2 8 5 4 7 9 6since 3 1 5 7 ≡ 2 1 3 4.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 13 / 34

Page 26: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permutation patterns

Pattern relation 4:π ∈ Sk is a pattern of σ ∈ Sn if ∃ 1 ≤ i1 < . . . < ik ≤ n such thatσi1 . . . σik is in the same relative order (≡) as π.

Notation: π 4 σ.

Equivalently:The normalization of σi1 . . . σik on[1..k] yields π.

Example: 2 1 3 4 4 3 1 2 8 5 4 7 9 6since 3 1 5 7 ≡ 2 1 3 4.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 13 / 34

Page 27: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permutation patterns

Pattern relation 4:π ∈ Sk is a pattern of σ ∈ Sn if ∃ 1 ≤ i1 < . . . < ik ≤ n such thatσi1 . . . σik is in the same relative order (≡) as π.

Notation: π 4 σ.

Equivalently:The normalization of σi1 . . . σik on[1..k] yields π.

Example: 2 1 3 4 4 3 1 2 8 5 4 7 9 6since 3 1 5 7 ≡ 2 1 3 4.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 13 / 34

Page 28: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permutation patterns

Pattern relation 4:π ∈ Sk is a pattern of σ ∈ Sn if ∃ 1 ≤ i1 < . . . < ik ≤ n such thatσi1 . . . σik is in the same relative order (≡) as π.

Notation: π 4 σ.

Equivalently:The normalization of σi1 . . . σik on[1..k] yields π.

Example: 2 1 3 4 4 3 1 2 8 5 4 7 9 6since 3 1 5 7 ≡ 2 1 3 4.

Observation: 4 is a partial order on S =⋃nSn.

This is the key to defining permutation classes.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 13 / 34

Page 29: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permutation classes

• A permutation class is a set C of permutations that is downward closedfor 4, i.e. whenever π 4 σ and σ ∈ C, then π ∈ C.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 14 / 34

Page 30: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permutation classes

• A permutation class is a set C of permutations that is downward closedfor 4, i.e. whenever π 4 σ and σ ∈ C, then π ∈ C.

1

12 21

123 132 213 231 312 321

1234 4321. . . . . .. . .1423 3142

σ

means π 4 σ

π

. . .

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 14 / 34

Page 31: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permutation classes

• A permutation class is a set C of permutations that is downward closedfor 4, i.e. whenever π 4 σ and σ ∈ C, then π ∈ C.

1

12 21

123 132 213 231 312 321

1234 4321. . . . . .. . .1423 3142

σ

means π 4 σ

π

. . .

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 14 / 34

Page 32: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permutation classes

• A permutation class is a set C of permutations that is downward closedfor 4, i.e. whenever π 4 σ and σ ∈ C, then π ∈ C.

1

12 21

123 132 213 231 312 321

1234 4321. . . . . .. . .1423 3142

σ

means π 4 σ

π

. . .

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 14 / 34

Page 33: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permutation classes

• A permutation class is a set C of permutations that is downward closedfor 4, i.e. whenever π 4 σ and σ ∈ C, then π ∈ C.

σ

means π 4 σ

π

. . .

C

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 14 / 34

Page 34: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permutation classes

• A permutation class is a set C of permutations that is downward closedfor 4, i.e. whenever π 4 σ and σ ∈ C, then π ∈ C.

• Notations: Av(π) = the set of permutations that avoid the pattern πAv(B) =

⋂π∈B

Av(π)

• Fact: For every permutation class C, C = Av(B) forB = {σ /∈ C : ∀π 4 σ such that π 6= σ, π ∈ C}.B is an antichain, called the basis of C.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 14 / 34

Page 35: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permutation classes

• A permutation class is a set C of permutations that is downward closedfor 4, i.e. whenever π 4 σ and σ ∈ C, then π ∈ C.

• Notations: Av(π) = the set of permutations that avoid the pattern πAv(B) =

⋂π∈B

Av(π)

• Fact: For every permutation class C, C = Av(B) forB = {σ /∈ C : ∀π 4 σ such that π 6= σ, π ∈ C}.B is an antichain, called the basis of C.

• Observations:

Conversely, every set Av(B) is a permutation class.

There exist infinite antichains, hence some permutation classes haveinfinite basis.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 14 / 34

Page 36: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permutation classes

• A permutation class is a set C of permutations that is downward closedfor 4, i.e. whenever π 4 σ and σ ∈ C, then π ∈ C.

• Notations: Av(π) = the set of permutations that avoid the pattern πAv(B) =

⋂π∈B

Av(π)

• Fact: For every permutation class C, C = Av(B) forB = {σ /∈ C : ∀π 4 σ such that π 6= σ, π ∈ C}.B is an antichain, called the basis of C.

• Observations:

Conversely, every set Av(B) is a permutation class.

There exist infinite antichains, hence some permutation classes haveinfinite basis.

In this talk, we focus on classes with finite basis.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 14 / 34

Page 37: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Main steps of an algorithm to compute a specification

Data: B a finite set of permutations

We are interested in C = Av(B).

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 15 / 34

Page 38: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Main steps of an algorithm to compute a specification

Data: B a finite set of permutations

We are interested in C = Av(B).

Step 1: From B (finite) to the simple permutations in CTest whether they are in finite number.

If yes, compute their set SC .

Step 2: From B and SC (both finite) to a specification for CFrom decomposition trees, propagate constraints in the subtrees.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 15 / 34

Page 39: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Main steps of an algorithm to compute a specification

Data: B a finite set of permutations

We are interested in C = Av(B).

Step 1: From B (finite) to the simple permutations in CTest whether they are in finite number.

If yes, compute their set SC .

Step 2: From B and SC (both finite) to a specification for CFrom decomposition trees, propagate constraints in the subtrees.

Result: A combinatorial specification for C. Hence also:

A polynomial system for the generating function.

Efficient random samplers of permutations in C.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 15 / 34

Page 40: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Main steps of an algorithm to compute a specification

Data: B a finite set of permutations

We are interested in C = Av(B).

Step 1: From B (finite) to the simple permutations in CTest whether they are in finite number.

If yes, compute their set SC .

Step 2: From B and SC (both finite) to a specification for CFrom decomposition trees, propagate constraints in the subtrees.

Result: A combinatorial specification for C. Hence also:

A polynomial system for the generating function.

Efficient random samplers of permutations in C.

Remark: Substitution-closed classes are a special (and easier) case.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 15 / 34

Page 41: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

One more definition: substitution-closed classes

Def.: A permutation class C is substitution-closed whenπ[α(1), α(2), . . . , α(k)] ∈ C for all π, α(1), α(2), . . . , α(k) ∈ C.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 16 / 34

Page 42: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

One more definition: substitution-closed classes

Def.: A permutation class C is substitution-closed whenπ[α(1), α(2), . . . , α(k)] ∈ C for all π, α(1), α(2), . . . , α(k) ∈ C.

Av(231) (stack sortable permutations) is not substitution-closed :

21[12, 1] = 231

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 16 / 34

Page 43: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

One more definition: substitution-closed classes

Def.: A permutation class C is substitution-closed whenπ[α(1), α(2), . . . , α(k)] ∈ C for all π, α(1), α(2), . . . , α(k) ∈ C.

Av(231) (stack sortable permutations) is not substitution-closed :

21[12, 1] = 231

Characterization: C = Av(B) is substitution-closed iff

the decomposition trees of permutations in C are all the ones built on theset SC of simple permutations in C. (and ⊕ and ).

or, equivalently, every permutation in B is simple.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 16 / 34

Page 44: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

One more definition: substitution-closed classes

Def.: A permutation class C is substitution-closed whenπ[α(1), α(2), . . . , α(k)] ∈ C for all π, α(1), α(2), . . . , α(k) ∈ C.

Av(231) (stack sortable permutations) is not substitution-closed :

21[12, 1] = 231

Characterization: C = Av(B) is substitution-closed iff

the decomposition trees of permutations in C are all the ones built on theset SC of simple permutations in C. (and ⊕ and ).

or, equivalently, every permutation in B is simple.

Example: Sep = Av(2413, 3142) is the smallest substitution-closed class thatcontains Av(231).It corresponds to decomposition trees with no prime nodes (SSep = ∅).

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 16 / 34

Page 45: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

One more definition: substitution-closed classes

Def.: A permutation class C is substitution-closed whenπ[α(1), α(2), . . . , α(k)] ∈ C for all π, α(1), α(2), . . . , α(k) ∈ C.

Characterization: C = Av(B) is substitution-closed iff

the decomposition trees of permutations in C are all the ones built on theset SC of simple permutations in C. (and ⊕ and ).

or, equivalently, every permutation in B is simple.

Def.: The substitution closure C of C is the smallest substitution-closed classcontaining C.

Construction: C = ∪k>1Ck with C1 = C etCk+1 = {σ[π1, . . . , πn] | σ ∈ C et πi ∈ Ck ∀i ∈ [1..n]}.

Characterization: C is the substitution-closed class built on SC (SC = SC).

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 16 / 34

Page 46: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

From the finite basis of Cto the simple permutations in C

Page 47: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Characterizing when a class contains finitely many simples

Theorem [Brignall, Huczynska & Vatter 08]:C = Av(B) contains finitely many simple permutations iff C contains:

1. finitely many parallel alternations

2. and finitely many wedge simple permutations

3. and finitely many proper pin-permutations

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 18 / 34

Page 48: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Characterizing when a class contains finitely many simples

Theorem [Brignall, Huczynska & Vatter 08]:C = Av(B) contains finitely many simple permutations iff C contains:

1. finitely many parallel alternations

2. and finitely many wedge simple permutations

3. and finitely many proper pin-permutations

Complexity : (with n =∑

π∈B |π|, k = |B| and s ≤ m = max |π|)↪→ 1. et 2. solved with pattern matching of small patterns in β ∈ B

in O(n log n) with n =∑

β∈B |β| from [Albert, Aldred, Atkinson &

Holton 01].

↪→ 3. solved using pin words and automata

in O(n · 8m + 2k·s·2s) from [Brignall, Ruskuc & Vatter 08]

↪→ Improvement from effective and recursive construction ofdeterministic and complete automata

in O(n + s2k) = O(n + 2k·2 log s) [Bassino, Bouvel, Pierrot & Rossin 15]

in O(n) if C is substitution-closed [Bassino, Bouvel, Pierrot & Rossin 10]

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 18 / 34

Page 49: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Characterizing when a class contains finitely many simples

Theorem [Brignall, Huczynska & Vatter 08]:C = Av(B) contains finitely many simple permutations iff C contains:

1. finitely many parallel alternations

2. and finitely many wedge simple permutations

3. and finitely many proper pin-permutations

Complexity : (with n =∑

π∈B |π|, k = |B| and s ≤ m = max |π|)↪→ 1. et 2. solved with pattern matching of small patterns in β ∈ B

in O(n log n) with n =∑

β∈B |β| from [Albert, Aldred, Atkinson &

Holton 01].

↪→ 3. solved using pin words and automata

in O(n · 8m + 2k·s·2s) from [Brignall, Ruskuc & Vatter 08]

↪→ Improvement from effective and recursive construction ofdeterministic and complete automata

in O(n + s2k) = O(n + 2k·2 log s) [Bassino, Bouvel, Pierrot & Rossin 15]

in O(n) if C is substitution-closed [Bassino, Bouvel, Pierrot & Rossin 10]

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 18 / 34

Page 50: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Characterizing when a class contains finitely many simples

Theorem [Brignall, Huczynska & Vatter 08]:C = Av(B) contains finitely many simple permutations iff C contains:

1. finitely many parallel alternations

2. and finitely many wedge simple permutations

3. and finitely many proper pin-permutations

Complexity : (with n =∑

π∈B |π|, k = |B| and s ≤ m = max |π|)↪→ 1. et 2. solved with pattern matching of small patterns in β ∈ B

in O(n log n) with n =∑

β∈B |β| from [Albert, Aldred, Atkinson &

Holton 01].

↪→ 3. solved using pin words and automata

in O(n · 8m + 2k·s·2s) from [Brignall, Ruskuc & Vatter 08]

↪→ Improvement from effective and recursive construction ofdeterministic and complete automata

in O(n + s2k) = O(n + 2k·2 log s) [Bassino, Bouvel, Pierrot & Rossin 15]

in O(n) if C is substitution-closed [Bassino, Bouvel, Pierrot & Rossin 10]

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 18 / 34

Page 51: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Computing the set SC of simple permutations in C . . .

(. . . assuming that SC is finite.)

Basic idea: Compute SC,n = SC ∩Sn, for increasing n.But when to stop?

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 19 / 34

Page 52: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Computing the set SC of simple permutations in C . . .

(. . . assuming that SC is finite.)

Basic idea: Compute SC,n = SC ∩Sn, for increasing n.But when to stop?

Theorem: [Albert & Atkinson 05] [Schmerl & Trotter 93]

If there is n such that C contains no simple permutation of size n nor ofsize n + 1, then C contains no simple permutation of size ≥ n.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 19 / 34

Page 53: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Computing the set SC of simple permutations in C . . .

(. . . assuming that SC is finite.)

Basic idea: Compute SC,n = SC ∩Sn, for increasing n.But when to stop?

Theorem: [Albert & Atkinson 05] [Schmerl & Trotter 93]

If there is n such that C contains no simple permutation of size n nor ofsize n + 1, then C contains no simple permutation of size ≥ n.

Algorithm to compute SC :

Naive algorithm: O(∑

j=1..`+2 j!jp+1 · |B|)Improved algorithm for substitution-closed classes: O(N · `4)Using properties of 4 on simple permutations [Pierrot & Rossin 16+]

Adaptation to non substitution-closed classes: O(N · `p+2 · |B|)where N = |SC |, p = maxβ∈B |β|, ` = maxπ∈SC |π|.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 19 / 34

Page 54: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

From the basis of C and the simples in Cto a combinatorial specification for C

Page 55: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

From a constructive proof to an algorithm

Theorem[Albert, Atkinson 2005]

If C contains a finite number of simple permutations, then it has a finitebasis and an algebraic generating function C (z).

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 21 / 34

Page 56: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

From a constructive proof to an algorithm

Theorem[Albert, Atkinson 2005]

If C contains a finite number of simple permutations, then it has a finitebasis and an algebraic generating function C (z).

Constructive proof (the GF part of the theorem):

Specialize the substitution decomposition theorem to C.

Obtain a (possibly ambiguous) context-free tree grammar for C.

Inclusion-exclusion gives a polynomial system for C (z).

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 21 / 34

Page 57: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

From a constructive proof to an algorithm

Theorem[Albert, Atkinson 2005]

If C contains a finite number of simple permutations, then it has a finitebasis and an algebraic generating function C (z).

Constructive proof (the GF part of the theorem):

Specialize the substitution decomposition theorem to C.

Obtain a (possibly ambiguous) context-free tree grammar for C.

Inclusion-exclusion gives a polynomial system for C (z).

Goals:

Compute an unambiguous tree grammar (= a specification) for C.

And do it algorithmically.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 21 / 34

Page 58: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

From a constructive proof to an algorithm

Theorem[Albert, Atkinson 2005]

If C contains a finite number of simple permutations, then it has a finitebasis and an algebraic generating function C (z).

Constructive proof (the GF part of the theorem):

Specialize the substitution decomposition theorem to C.

Obtain a (possibly ambiguous) context-free tree grammar for C.

Inclusion-exclusion gives a polynomial system for C (z).

Goals:

Compute an unambiguous tree grammar (= a specification) for C.

And do it algorithmically.

Remark (on the finite basis part of the theorem): The real restriction isnot having a finite basis, but rather containing finitely many simples.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 21 / 34

Page 59: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Substitution-closed classes

C〈B?〉 = •+

C+ C〈B?〉+

C− C〈B?〉+

∑π∈SC

π

C C . . . C〈B?〉

C+

〈B?〉

= •+

C− C

〈B?〉

+∑

π∈SCπ

C C . . . C

〈B?〉

C−

〈B?〉

= •+⊕

C+ C

〈B?〉

+∑

π∈SCπ

C C . . . C

〈B?〉

• When C is substitution-closed,SC immediately gives an unambiguous tree grammar for C.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 22 / 34

Page 60: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Substitution-closed classes . . . to all classes

C〈B?〉 = •+⊕

C+ C〈B?〉+

C− C〈B?〉+

∑π∈SC

π

C C . . . C〈B?〉

C+

〈B?〉

= •+

C− C

〈B?〉

+∑

π∈SCπ

C C . . . C

〈B?〉

C−

〈B?〉

= •+⊕

C+ C

〈B?〉

+∑

π∈SCπ

C C . . . C

〈B?〉

• When C is substitution-closed,SC immediately gives an unambiguous tree grammar for C.

• When C = Av(B) is not substitution-closed,

It still holds for C, with SC = SC .

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 22 / 34

Page 61: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Substitution-closed classes . . . to all classes

C〈B?〉 = •+⊕

C+ C〈B?〉+

C− C〈B?〉+

∑π∈SC

π

C C . . . C〈B?〉

C+

〈B?〉

= •+

C− C

〈B?〉

+∑

π∈SCπ

C C . . . C

〈B?〉

C−

〈B?〉

= •+⊕

C+ C

〈B?〉

+∑

π∈SCπ

C C . . . C

〈B?〉

• When C is substitution-closed,SC immediately gives an unambiguous tree grammar for C.

• When C = Av(B) is not substitution-closed,

It still holds for C, with SC = SC .

C = C〈B?〉 = C ∩ Av(B?), where B? = the non simples in B

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 22 / 34

Page 62: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Substitution-closed classes . . . to all classes

C〈B?〉 = •+⊕

C+ C〈B?〉+

C− C〈B?〉+

∑π∈SC

π

C C . . . C〈B?〉

C+

〈B?〉

= •+

C− C

〈B?〉

+∑

π∈SCπ

C C . . . C

〈B?〉

C−

〈B?〉

= •+⊕

C+ C

〈B?〉

+∑

π∈SCπ

C C . . . C

〈B?〉

• When C is substitution-closed,SC immediately gives an unambiguous tree grammar for C.

• When C = Av(B) is not substitution-closed,

It still holds for C, with SC = SC .

C = C〈B?〉 = C ∩ Av(B?), where B? = the non simples in B

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 22 / 34

Page 63: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Substitution-closed classes . . . to all classes

C〈B?〉 = •+⊕

C+ C〈B?〉+

C− C〈B?〉+

∑π∈SC

π

C C . . . C〈B?〉

C+

〈B?〉

= •+

C− C

〈B?〉

+∑

π∈SCπ

C C . . . C

〈B?〉

C−

〈B?〉

= •+⊕

C+ C

〈B?〉

+∑

π∈SCπ

C C . . . C

〈B?〉

• When C is substitution-closed,SC immediately gives an unambiguous tree grammar for C.

• When C = Av(B) is not substitution-closed,

It still holds for C, with SC = SC .

C = C〈B?〉 = C ∩ Av(B?), where B? = the non simples in B

The pattern avoidance constraints need to be pushed in the subtrees,adding new equations to the system . . . and recursively so

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 22 / 34

Page 64: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Substitution-closed classes . . . to all classes

C〈B?〉 = •+⊕

C+ C〈B?〉+

C− C〈B?〉+

∑π∈SC

π

C C . . . C〈B?〉

C+〈B?〉 = •+

C− C〈B?〉+

∑π∈SC

π

C C . . . C〈B?〉

C−〈B?〉 = •+⊕

C+ C〈B?〉+

∑π∈SC

π

C C . . . C〈B?〉

• When C is substitution-closed,SC immediately gives an unambiguous tree grammar for C.

• When C = Av(B) is not substitution-closed,

It still holds for C, with SC = SC .

C = C〈B?〉 = C ∩ Av(B?), where B? = the non simples in B

The pattern avoidance constraints need to be pushed in the subtrees,adding new equations to the system . . . and recursively so

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 22 / 34

Page 65: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Pushing restrictions in the subtrees

Example: C = Av(231).We have SC = SC = ∅, and C = C〈231〉.

C = C〈231〉 = • +⊕

C+ C〈231〉 +

C− C〈231〉

= •

+⊕

C+〈231〉 C〈231〉

+

C−〈12〉 C〈231〉

C−〈12〉 = . . .

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 23 / 34

Page 66: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Pushing restrictions in the subtrees

Example: C = Av(231).We have SC = SC = ∅, and C = C〈231〉.

C = C〈231〉 = • +⊕

C+ C〈231〉 +

C− C〈231〉

= •

+⊕

C+〈231〉 C〈231〉+

C−〈12〉 C〈231〉

C−〈12〉 = . . .

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 23 / 34

Page 67: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Pushing restrictions in the subtrees

Example: C = Av(231).We have SC = SC = ∅, and C = C〈231〉.

C = C〈231〉 = • +⊕

C+ C〈231〉 +

C− C〈231〉

= •

+⊕

C+〈231〉 C〈231〉+

C−〈12〉 C〈231〉

C−〈12〉 = . . .

Claim:

TL TR

=

σL

σR ∈ Av(231)⇔ σL ∈ Av(12) and σR ∈ Av(231)

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 23 / 34

Page 68: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Pushing restrictions in the subtrees

Example: C = Av(231).We have SC = SC = ∅, and C = C〈231〉.

C = C〈231〉 = • +⊕

C+ C〈231〉 +

C− C〈231〉

= •

+⊕

C+〈231〉 C〈231〉

+

C−〈12〉 C〈231〉

C−〈12〉 = . . .

Claim:

TL TR

=

σL

σR ∈ Av(231)⇔ σL ∈ Av(12) and σR ∈ Av(231)

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 23 / 34

Page 69: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Pushing restrictions in the subtrees

Example: C = Av(231).We have SC = SC = ∅, and C = C〈231〉.

C = C〈231〉 = • +⊕

C+ C〈231〉 +

C− C〈231〉

= •

+⊕

C+〈231〉 C〈231〉

+

C−〈12〉 C〈231〉

C−〈12〉 = . . .

Claim:

TL TR

=

σL

σR ∈ Av(231)⇔ σL ∈ Av(12) and σR ∈ Av(231)

Because of an embedding of 231 into 21 = : = 231 ↪→ 21 =

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 23 / 34

Page 70: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Pushing restrictions in the subtrees

Example: C = Av(231).We have SC = SC = ∅, and C = C〈231〉.

C = C〈231〉 = • +⊕

C+ C〈231〉 +

C− C〈231〉

= • +⊕

C+〈231〉 C〈231〉+

C−〈12〉 C〈231〉

C−〈12〉 = . . .

Claim:

TL TR

=

σL

σR ∈ Av(231)⇔ σL ∈ Av(12) and σR ∈ Av(231)

Because of an embedding of 231 into 21 = : = 231 ↪→ 21 =

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 23 / 34

Page 71: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Pushing restrictions in the subtrees

Example: C = Av(231).We have SC = SC = ∅, and C = C〈231〉.

C = C〈231〉 = • +⊕

C+ C〈231〉 +

C− C〈231〉

= • +⊕

C+〈231〉 C〈231〉+

C−〈12〉 C〈231〉

C−〈12〉 = . . .

Claim:

TL TR

=

σL

σR ∈ Av(231)⇔ σL ∈ Av(12) and σR ∈ Av(231)

Because of an embedding of 231 into 21 = : = 231 ↪→ 21 =

Need of a new equation for C−〈12〉 . . . And keep going

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 23 / 34

Page 72: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Why the grammar may be ambiguous

Pattern avoidance constraints in the subtrees come fromembeddings of β ∈ B? into π ∈ SC ∪ {12, 21}.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 24 / 34

Page 73: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Why the grammar may be ambiguous

Pattern avoidance constraints in the subtrees come fromembeddings of β ∈ B? into π ∈ SC ∪ {12, 21}.

Example with β = 3412 and π = 21. Three embeddings of β into π:

↪→ ; ↪→ ; ↪→

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 24 / 34

Page 74: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Why the grammar may be ambiguous

Pattern avoidance constraints in the subtrees come fromembeddings of β ∈ B? into π ∈ SC ∪ {12, 21}.

Example with β = 3412 and π = 21. Three embeddings of β into π:

↪→ ; ↪→ ; ↪→

Hence:

C− C〈3412〉 =

C−〈3412〉 C

C− C〈3412〉∩ (

C−〈12〉 C

C− C〈12〉)

=

C−〈12〉 C〈3412〉∪ C−〈3412〉 C〈12〉

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 24 / 34

Page 75: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Why the grammar may be ambiguous

Pattern avoidance constraints in the subtrees come fromembeddings of β ∈ B? into π ∈ SC ∪ {12, 21}.

Example with β = 3412 and π = 21. Three embeddings of β into π:

↪→ ; ↪→ ; ↪→

Hence:

C− C〈3412〉 =

C−〈3412〉 C

C− C〈3412〉∩ (

C−〈12〉 C

C− C〈12〉)

=

C−〈12〉 C〈3412〉∪ C−〈3412〉 C〈12〉

This is not a disjoint union (consider for instance 21).

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 24 / 34

Page 76: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Why the grammar may be ambiguous

Pattern avoidance constraints in the subtrees come fromembeddings of β ∈ B? into π ∈ SC ∪ {12, 21}.

Example with β = 3412 and π = 21. Three embeddings of β into π:

↪→ ; ↪→ ; ↪→

Hence:

C− C〈3412〉 =

C−〈3412〉 C

C− C〈3412〉∩ (

C−〈12〉 C

C− C〈12〉)

=

C−〈12〉 C〈3412〉∪ C−〈3412〉 C〈12〉

This is not a disjoint union (consider for instance 21).

Observation: The new excluded patterns are some α 4 β ∈ B?

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 24 / 34

Page 77: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Need of introducing pattern containment constraints

Example: Disambiguation of

C−〈12〉 C〈3412〉∪ C−〈3412〉 C〈12〉

.

Method:

A ∪ B = A ∩ B ] A ∩ B ] A ∩ B

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 25 / 34

Page 78: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Need of introducing pattern containment constraints

Example: Disambiguation of

C−〈12〉 C〈3412〉∪ C−〈3412〉 C〈12〉

.

Method:

A ∪ B = A ∩ B ] A ∩ B ] A ∩ B

By complementation, excluded patterns become mandatory patterns:Cγ for γ 4 β ∈ B?

C− C〈3412〉 =

C−〈12〉 C〈12〉

] C−12〈3412〉 C〈12〉

] C−〈12〉 C12〈3412〉

.

Notice that the terms

C−〈3412〉 C3412〈12〉and

C−3412〈12〉 C〈3412〉

are empty,

and have been deleted.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 25 / 34

Page 79: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Need of introducing pattern containment constraints

Example: Disambiguation of

C−〈12〉 C〈3412〉∪ C−〈3412〉 C〈12〉

.

Method:

A ∪ B = A ∩ B ] A ∩ B ] A ∩ B

By complementation, excluded patterns become mandatory patterns:Cγ for γ 4 β ∈ B?

C− C〈3412〉 =

C−〈12〉 C〈12〉

] C−12〈3412〉 C〈12〉

] C−〈12〉 C12〈3412〉

.

⇒ Need to propagate avoidance and containment constraints:

Cεγ1,...,γp〈α1, . . . , αk〉 with ε ∈ { ,+,−}

Observation: γi and αj are all patterns of some β ∈ B?.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 25 / 34

Page 80: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Computing only the necessary restrictions

Algorithm: [Bassino, Bouvel, Pierrot, Pivoteau & Rossin, 16+]

Start from C = C〈B?〉, C+ and C−, and propagate the patternavoidance constraints in the subtrees.

Disambiguate the equations, introducing pattern containmentconstraints.

For each term Cεγ1,...,γp〈α1, . . . , αk〉 that appears on the RHS, repeatthis process, recursively.

Properties:

This algorithm terminates and produces a specification for C.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 26 / 34

Page 81: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Computing only the necessary restrictions

Algorithm: [Bassino, Bouvel, Pierrot, Pivoteau & Rossin, 16+]

Start from C = C〈B?〉, C+ and C−, and propagate the patternavoidance constraints in the subtrees.

Disambiguate the equations, introducing pattern containmentconstraints.

For each term Cεγ1,...,γp〈α1, . . . , αk〉 that appears on the RHS, repeatthis process, recursively.

Properties:

This algorithm terminates and produces a specification for C.

Questions:

What is the complexity?

What is the size of the specification produced?

↪→ It can be exponential in |B|. But how big can it be?

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 26 / 34

Page 82: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Summary: From the basis to the specification

Algorithmic chain from B finite to a specification for C = Av(B).

Is there a finite number of simple permutations in the class C=Av(B)?

O(n log n)

B: finite basis of excluded patterns

B contains only simple permutationsAv(B) is substitution-closed

B contains permutations that are not simpleAv(B) is not substitution-closed

NO

YES

Computation of the subset Sc of simple permutations in C

direct

STOP

O(N. l )4O(N. l . |B| )p+2

O(n log n+p )2k

Compute an ambiguous system by propagation of pattern avoidance constraints

Constraints propagation

Compute an unambiguous system of equationsfor generating functions using the inclusion-exclusion principle

Disambiguation of the combinatorial system

- transform intersecting unions into disjoint unions introducing complement sets- express complement sets by means of pattern containment constraints

Generating functionsBoltzmann sampler

Specification for C

where n =∑

β∈B |β|, p = maxβ∈B |β|, k = |B|, N = |SC |, ` = maxπ∈SC |π|.

Remark: It succeeds only when C contains finitely many simples (and thiscondition is tested algorithmically).

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 27 / 34

Page 83: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Random generation andstudy of random permutations

Page 84: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

A specification for C gives access to. . .

A polynomial system defining C (z) (implicitly)[Flajolet & Sedgewick 09]

↪→ Can it be used to obtain information on the dominant singularity ofC (z), or equivalently the growth rate of C?

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 29 / 34

Page 85: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

A specification for C gives access to. . .

A polynomial system defining C (z) (implicitly)[Flajolet & Sedgewick 09]

↪→ Can it be used to obtain information on the dominant singularity ofC (z), or equivalently the growth rate of C?

Random samplers of permutations in C:

I by the recursive method [Flajolet, Zimmerman & Van Cutsem 94]

I by the Boltzmann method [Duchon, Flajolet, Louchard & Schaeffer 04]

↪→ Implementation (in progress) to observe random permutations inpermutation classes.

↪→ Can we describe the “average shape” or average properties of randompermutations in permutation classes?For some given classes, or for families of classes?

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 29 / 34

Page 86: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Random permutations in permutation classes

• C1 = Av(2413, 3142) = separables.Substitution-closed with no simples.10000 permutations of size 100 in C1.

• Substitution-closed class C2,with simples 2413, 3142 and 24153.10000 permutations of size 500 in C2.

• C3 = Av(2413, 1243, 2341, 531642, 41352).Not substitution-closed.Almost 30000 permutations of size 500 in C3.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 30 / 34

Page 87: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Random separable permutations

• Two typical separable permutations of sizes respectively n = 204 523 and

n = 903 073 (a permutation σ is represented here with its diagram: for every

i ≤ n, there is a dot at coordinates (i , σi )).

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 31 / 34

Page 88: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Number of occurrences of a pattern π in a randomseparable permutation

Question: What is the asymptotics in n of the number of occurrences of apattern π in a uniform separable permutation σn of n elements ?

Denote by occ(π, σ) the proportion of occurrences of a pattern π in σ(between all patterns of the same size contained in the permutation).

Theorem: [Bassino, Bouvel, Feray, Gerin, Pierrot, 16+]

Let σn be a uniform separable permutation of size n. There exists acollection of random variables (Λπ), π ranging over all permutations, suchthat for all π, 0 ≤ Λπ ≤ 1 and when n→ +∞,

occ(π, σn)(d)→ Λπ,

where(d)→ denotes the convergence in distribution.

if π is a separable permutation of size at least 2, Λπ is a non-deterministicrandom variable. (Clearly, Λπ= 0 or 1 otherwise.)

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 32 / 34

Page 89: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Number of occurrences of a pattern π in a randomseparable permutation

Question: What is the asymptotics in n of the number of occurrences of apattern π in a uniform separable permutation σn of n elements ?Denote by occ(π, σ) the proportion of occurrences of a pattern π in σ(between all patterns of the same size contained in the permutation).

Theorem: [Bassino, Bouvel, Feray, Gerin, Pierrot, 16+]

Let σn be a uniform separable permutation of size n. There exists acollection of random variables (Λπ), π ranging over all permutations, suchthat for all π, 0 ≤ Λπ ≤ 1 and when n→ +∞,

occ(π, σn)(d)→ Λπ,

where(d)→ denotes the convergence in distribution.

if π is a separable permutation of size at least 2, Λπ is a non-deterministicrandom variable. (Clearly, Λπ= 0 or 1 otherwise.)

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 32 / 34

Page 90: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Number of occurrences of a pattern π in a randomseparable permutation

Question: What is the asymptotics in n of the number of occurrences of apattern π in a uniform separable permutation σn of n elements ?Denote by occ(π, σ) the proportion of occurrences of a pattern π in σ(between all patterns of the same size contained in the permutation).

Theorem: [Bassino, Bouvel, Feray, Gerin, Pierrot, 16+]

Let σn be a uniform separable permutation of size n. There exists acollection of random variables (Λπ), π ranging over all permutations, suchthat for all π, 0 ≤ Λπ ≤ 1 and when n→ +∞,

occ(π, σn)(d)→ Λπ,

where(d)→ denotes the convergence in distribution.

if π is a separable permutation of size at least 2, Λπ is a non-deterministicrandom variable. (Clearly, Λπ= 0 or 1 otherwise.)

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 32 / 34

Page 91: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Construction of Λπ

From a Schroder tree of a separable pattern π (otherwise it does not occurin a separable permutation), we buit a contour.

+

–– –

+ –

++ +0,12,14,20

1,9,11

2,4,6,8

3 5 7

10

13

15,17,19

16 18

+ +

A (signed) tree and its (signed) contour

The normalized contour of a uniform Schroder tree converges indistribution to a multiple of the Brownian excursion [Pittman, Rizzolo, 2015].To prove a signed version of this result seems to be very difficult.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 33 / 34

Page 92: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Construction of Λπ

An excursion is a continuous function f : [0, 1]→ R+ withf (0) = f (1) = 0.From an excursion f and a set of points x = {x1, . . . , xk} in [0, 1], there isa construction to get a Schroder tree, looking at the local minima of fbetween the xi ’s.

+

+

x2x1 x3 x4

-

+

+

Extracting a (signed) tree from a (signed) excursion

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 33 / 34

Page 93: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Construction of Λπ

An excursion is a continuous function f : [0, 1]→ R+ withf (0) = f (1) = 0.From an excursion f and a set of points x = {x1, . . . , xk} in [0, 1], there isa construction to get a Schroder tree, looking at the local minima of fbetween the xi ’s.

+

+

x2x1 x3 x4

-

+

+

Extracting a (signed) tree from a (signed) excursion

A signed excursion is an excursion where the local minima are given a sign+ or −. Let π be a pattern of size k.Let Ψπ(f , s) be the probability that the signed tree extracted from (f , s) isa signed Schroder tree of π when X consists of k uniform and independentpoints in [0, 1].

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 33 / 34

Page 94: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Construction of Λπ

+

+

x2x1 x3 x4

-

+

+

Extracting a (signed) tree from a (signed) excursion

A signed excursion is an excursion where the local minima are given a sign+ or −. Let π be a pattern of size k.Let Ψπ(f , s) be the probability that the signed tree extracted from (f , s) isa signed Schroder tree of π when X consists of k uniform and independentpoints in [0, 1].The signed Brownian excursion as the pair (e, S), where e is the Brownianexcursion, and S assigns signs to the local minima of e in a balanced andindependent manner. Then Λπ = Ψπ(e, S).

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 33 / 34

Page 95: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permuton interpretation of the result

A permuton is a measure on the square [0, 1]2 with uniform marginals.

The permutation diagram of any permutation σ of size n can be seen as apermuton µσ, up to normalization:

rescale the diagram of σ so that it fits in the unit square,

replace every point (i , σ(i)) by a square[(i − 1)/n, i/n]× [(σ(i)− 1)/n, σ(i)/n] having weight 1/n.

Theorem: [Bassino, Bouvel, Feray, Gerin, Pierrot, 16+]

Let σn be a uniform random separable permutation of size n. There existsa random permuton µ such that the permuton µσn associated to σn tendsto µ in distribution.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 34 / 34

Page 96: How to generate a random permutation in a permutation class? · How to generate a random permutation in a permutation class? Fr ed erique Bassino (Laboratoire d’informatique de

Permuton interpretation of the result

A permuton is a measure on the square [0, 1]2 with uniform marginals.

The permutation diagram of any permutation σ of size n can be seen as apermuton µσ, up to normalization:

rescale the diagram of σ so that it fits in the unit square,

replace every point (i , σ(i)) by a square[(i − 1)/n, i/n]× [(σ(i)− 1)/n, σ(i)/n] having weight 1/n.

Theorem: [Bassino, Bouvel, Feray, Gerin, Pierrot, 16+]

Let σn be a uniform random separable permutation of size n. There existsa random permuton µ such that the permuton µσn associated to σn tendsto µ in distribution.

Frederique Bassino (LIPN, Univ. Paris 13) () Random generation of permutations 34 / 34