Skip to content

Implementation of blossoming trees for their bijection with Tamari intervals#41416

Merged
vbraun merged 51 commits intosagemath:developfrom
fwjmath:blossoming
Mar 22, 2026
Merged

Implementation of blossoming trees for their bijection with Tamari intervals#41416
vbraun merged 51 commits intosagemath:developfrom
fwjmath:blossoming

Conversation

@fwjmath
Copy link
Copy Markdown
Contributor

@fwjmath fwjmath commented Jan 8, 2026

This is an implementation of the bijection between blossoming trees and Tamari intervals in the following paper:

Wenjie Fang, Éric Fusy, Philippe Nadeau, "Tamari intervals and blossoming trees". Combinatorial Theory, Volume 5, Issue 1. doi 10.5070/C65165015.

It is the implementation mentioned in the paper, but with additional "Sage-compliant" comments and tests, along with some small restructuring.

More precisely, we provide four new classes.

  • TamariBlossomingTree: main class that implements blossoming trees and their bijection with Tamari intervals, along with plots and conversion to other Sage objects.
  • TamariBlossomingTreeFactory: a linear-time random generator of Tamari blossoming tree.
  • SynchronizedBlossomingTreeFactory: a linear-time random generator of synchronized blossoming trees, which are in bijection with synchronized Tamari intervals.
  • ModernBlossomingTreeFactory: a linear-time random generator of modern blossoming trees, which are in bijection with modern Tamari intervals.

This implementation will allow users to explore Tamari intervals more easily with our bijection. Most notably, these classes now enables an efficient random generation of large (general, synchronized or modern) Tamari intervals, linear in the size of generated objects. Such generator exists for general Tamari intervals in TamariIntervalPosets, but it goes through triangulations, thus is much slower and more complicated. Here is a comparison of timing:

sage: TIP = TamariIntervalPosets(1000)
sage: %time tip = TIP.random_element()
CPU times: user 5.13 s, sys: 15 ms, total: 5.14 s
Wall time: 5.14 s
sage: TBTF = TamariBlossomingTreeFactory(1000)
sage: %time B = TBTF.random_element()
CPU times: user 118 ms, sys: 2.99 ms, total: 121 ms
Wall time: 120 ms

The random generation of synchronized and modern Tamari intervals is new.

As I am not familiar with the internal structure of Sagemath, these classes were written more like an external module. Advises and help for a restructuring are welcomed. Notably, I did not implement a class for the set of blossoming trees like those for other combinatorial objects. The reason is two-fold:

  1. I am not familiar with the internal working of Sagemath, notably metaclasses, Parent and Element, and the documentation seems to be quite complicated.
  2. I do not intend to provide exhaustive generation, which is less efficient (not linear but quadratic in object size per object).
    I may have changed a bit the idea for the second point, as when I look at the exhaustive generation code in the iterator of TamariIntervalPosets_size, its complexity is not clear. It is not linear, but not clear whether quadratic per object. There is a possibility that the class IntegerListsLex may provide an efficient exhaustive generation of related lattice paths to make our bijection more efficient for exhaustive generation.

Thanks @fchapoton for suggesting adapting my original implementation to Sagemath.

By the way, I have not checked whether the documentation shows up correctly in the references, because sage --docbuild reference html fails with the error

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/fwjmath/svn/sage/src/sage_docbuild/__main__.py", line 545, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/fwjmath/svn/sage/src/sage_docbuild/__main__.py", line 540, in main
    build = getattr(builder, typ)
            ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ReferenceBuilder' object has no attribute 'html'

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

@fchapoton fchapoton self-assigned this Jan 8, 2026
@fchapoton
Copy link
Copy Markdown
Contributor

Salut. Tu m'autorises à faire un commit pour reparer le linter ?

@fwjmath
Copy link
Copy Markdown
Contributor Author

fwjmath commented Jan 8, 2026

Salut. Tu m'autorises à faire un commit pour reparer le linter ?

Bien sûr ! Je n'arrive pas à régler le problème en tout cas...

Est-ce qu'il y a une manip que je dois faire ? J'ai déjà croché "Allowing edits by maintainers".

@fchapoton
Copy link
Copy Markdown
Contributor

ok, je m'en occupe

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 8, 2026

Documentation preview for this PR (built with commit 1d6435b; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@fchapoton
Copy link
Copy Markdown
Contributor

voila, le linter est réparé, je te repasse la main

@fchapoton
Copy link
Copy Markdown
Contributor

il faudrait ajouter ton nouveau fichier quelque part dans la liste dans src/doc/en/reference/combinat/module_list.rst

@fwjmath
Copy link
Copy Markdown
Contributor Author

fwjmath commented Jan 22, 2026

Il y a maintenant la structure Parent et Element. Pour les métaclasses, en fait c'est imposé par les classes de base, donc il n'est pas utile de trop y réfléchir. J'ai aussi refait un peu de refactoring pour pouvoir utiliser les générateurs aléatoires directement dans la class TamariBlossomingTrees sans chercher les classes d'usine.

@fchapoton
Copy link
Copy Markdown
Contributor

fchapoton commented Jan 23, 2026

pas une bonne idee du tout de tripatouiller le fichier all.py ; ca rend les changements penibles à lire ....

OK, pardon, tu as fais un roll-back, c'est correct

Comment thread src/sage/combinat/interval_posets.py Outdated
Copy link
Copy Markdown
Contributor

@fchapoton fchapoton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good enough. Let's move this in

vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 28, 2026
sagemathgh-41416: Implementation of blossoming trees for their bijection with Tamari intervals
    
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

This is an implementation of the bijection between blossoming trees and
Tamari intervals in the following paper:

Wenjie Fang, Éric Fusy, Philippe Nadeau, "Tamari intervals and
blossoming trees". Combinatorial Theory, Volume 5, Issue 1. doi
`10.5070/C65165015`.

It is the implementation mentioned in the paper, but with additional
"Sage-compliant" comments and tests, along with some small
restructuring.

More precisely, we provide four new classes.

- `TamariBlossomingTree`: main class that implements blossoming trees
and their bijection with Tamari intervals, along with plots and
conversion to other Sage objects.
- `TamariBlossomingTreeFactory`: a linear-time random generator of
Tamari blossoming tree.
- `SynchronizedBlossomingTreeFactory`: a linear-time random generator of
synchronized blossoming trees, which are in bijection with synchronized
Tamari intervals.
- `ModernBlossomingTreeFactory`: a linear-time random generator of
modern blossoming trees, which are in bijection with modern Tamari
intervals.

This implementation will allow users to explore Tamari intervals more
easily with our bijection. Most notably, these classes now enables an
efficient random generation of large (general, synchronized or modern)
Tamari intervals, linear in the size of generated objects. Such
generator exists for general Tamari intervals in TamariIntervalPosets,
but it goes through triangulations, thus is much slower and more
complicated. Here is a comparison of timing:
```
sage: TIP = TamariIntervalPosets(1000)
sage: %time tip = TIP.random_element()
CPU times: user 5.13 s, sys: 15 ms, total: 5.14 s
Wall time: 5.14 s
sage: TBTF = TamariBlossomingTreeFactory(1000)
sage: %time B = TBTF.random_element()
CPU times: user 118 ms, sys: 2.99 ms, total: 121 ms
Wall time: 120 ms
```
The random generation of synchronized and modern Tamari intervals is
new.

As I am not familiar with the internal structure of Sagemath, these
classes were written more like an external module. Advises and help for
a restructuring are welcomed. Notably, I did not implement a class for
the set of blossoming trees like those for other combinatorial objects.
The reason is two-fold:
1. I am not familiar with the internal working of Sagemath, notably
metaclasses, Parent and Element, and the documentation seems to be quite
complicated.
2. I do not intend to provide exhaustive generation, which is less
efficient (not linear but quadratic in object size per object).
I may have changed a bit the idea for the second point, as when I look
at the exhaustive generation code in the iterator of
``TamariIntervalPosets_size``, its complexity is not clear. It is not
linear, but not clear whether quadratic per object. There is a
possibility that the class ``IntegerListsLex`` may provide an efficient
exhaustive generation of related lattice paths to make our bijection
more efficient for exhaustive generation.

Thanks @fchapoton for suggesting adapting my original implementation to
Sagemath.

By the way, I have not checked whether the documentation shows up
correctly in the references, because ``sage --docbuild reference html``
fails with the error
```
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/fwjmath/svn/sage/src/sage_docbuild/__main__.py", line 545,
in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/fwjmath/svn/sage/src/sage_docbuild/__main__.py", line 540,
in main
    build = getattr(builder, typ)
            ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ReferenceBuilder' object has no attribute 'html'
```

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [X] The title is concise and informative.
- [X] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [X] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#41416
Reported by: fwjmath
Reviewer(s): Frédéric Chapoton, fwjmath
vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 6, 2026
sagemathgh-41416: Implementation of blossoming trees for their bijection with Tamari intervals
    
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

This is an implementation of the bijection between blossoming trees and
Tamari intervals in the following paper:

Wenjie Fang, Éric Fusy, Philippe Nadeau, "Tamari intervals and
blossoming trees". Combinatorial Theory, Volume 5, Issue 1. doi
`10.5070/C65165015`.

It is the implementation mentioned in the paper, but with additional
"Sage-compliant" comments and tests, along with some small
restructuring.

More precisely, we provide four new classes.

- `TamariBlossomingTree`: main class that implements blossoming trees
and their bijection with Tamari intervals, along with plots and
conversion to other Sage objects.
- `TamariBlossomingTreeFactory`: a linear-time random generator of
Tamari blossoming tree.
- `SynchronizedBlossomingTreeFactory`: a linear-time random generator of
synchronized blossoming trees, which are in bijection with synchronized
Tamari intervals.
- `ModernBlossomingTreeFactory`: a linear-time random generator of
modern blossoming trees, which are in bijection with modern Tamari
intervals.

This implementation will allow users to explore Tamari intervals more
easily with our bijection. Most notably, these classes now enables an
efficient random generation of large (general, synchronized or modern)
Tamari intervals, linear in the size of generated objects. Such
generator exists for general Tamari intervals in TamariIntervalPosets,
but it goes through triangulations, thus is much slower and more
complicated. Here is a comparison of timing:
```
sage: TIP = TamariIntervalPosets(1000)
sage: %time tip = TIP.random_element()
CPU times: user 5.13 s, sys: 15 ms, total: 5.14 s
Wall time: 5.14 s
sage: TBTF = TamariBlossomingTreeFactory(1000)
sage: %time B = TBTF.random_element()
CPU times: user 118 ms, sys: 2.99 ms, total: 121 ms
Wall time: 120 ms
```
The random generation of synchronized and modern Tamari intervals is
new.

As I am not familiar with the internal structure of Sagemath, these
classes were written more like an external module. Advises and help for
a restructuring are welcomed. Notably, I did not implement a class for
the set of blossoming trees like those for other combinatorial objects.
The reason is two-fold:
1. I am not familiar with the internal working of Sagemath, notably
metaclasses, Parent and Element, and the documentation seems to be quite
complicated.
2. I do not intend to provide exhaustive generation, which is less
efficient (not linear but quadratic in object size per object).
I may have changed a bit the idea for the second point, as when I look
at the exhaustive generation code in the iterator of
``TamariIntervalPosets_size``, its complexity is not clear. It is not
linear, but not clear whether quadratic per object. There is a
possibility that the class ``IntegerListsLex`` may provide an efficient
exhaustive generation of related lattice paths to make our bijection
more efficient for exhaustive generation.

Thanks @fchapoton for suggesting adapting my original implementation to
Sagemath.

By the way, I have not checked whether the documentation shows up
correctly in the references, because ``sage --docbuild reference html``
fails with the error
```
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/fwjmath/svn/sage/src/sage_docbuild/__main__.py", line 545,
in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/fwjmath/svn/sage/src/sage_docbuild/__main__.py", line 540,
in main
    build = getattr(builder, typ)
            ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ReferenceBuilder' object has no attribute 'html'
```

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [X] The title is concise and informative.
- [X] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [X] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#41416
Reported by: fwjmath
Reviewer(s): Frédéric Chapoton, fwjmath
vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 15, 2026
sagemathgh-41416: Implementation of blossoming trees for their bijection with Tamari intervals
    
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

This is an implementation of the bijection between blossoming trees and
Tamari intervals in the following paper:

Wenjie Fang, Éric Fusy, Philippe Nadeau, "Tamari intervals and
blossoming trees". Combinatorial Theory, Volume 5, Issue 1. doi
`10.5070/C65165015`.

It is the implementation mentioned in the paper, but with additional
"Sage-compliant" comments and tests, along with some small
restructuring.

More precisely, we provide four new classes.

- `TamariBlossomingTree`: main class that implements blossoming trees
and their bijection with Tamari intervals, along with plots and
conversion to other Sage objects.
- `TamariBlossomingTreeFactory`: a linear-time random generator of
Tamari blossoming tree.
- `SynchronizedBlossomingTreeFactory`: a linear-time random generator of
synchronized blossoming trees, which are in bijection with synchronized
Tamari intervals.
- `ModernBlossomingTreeFactory`: a linear-time random generator of
modern blossoming trees, which are in bijection with modern Tamari
intervals.

This implementation will allow users to explore Tamari intervals more
easily with our bijection. Most notably, these classes now enables an
efficient random generation of large (general, synchronized or modern)
Tamari intervals, linear in the size of generated objects. Such
generator exists for general Tamari intervals in TamariIntervalPosets,
but it goes through triangulations, thus is much slower and more
complicated. Here is a comparison of timing:
```
sage: TIP = TamariIntervalPosets(1000)
sage: %time tip = TIP.random_element()
CPU times: user 5.13 s, sys: 15 ms, total: 5.14 s
Wall time: 5.14 s
sage: TBTF = TamariBlossomingTreeFactory(1000)
sage: %time B = TBTF.random_element()
CPU times: user 118 ms, sys: 2.99 ms, total: 121 ms
Wall time: 120 ms
```
The random generation of synchronized and modern Tamari intervals is
new.

As I am not familiar with the internal structure of Sagemath, these
classes were written more like an external module. Advises and help for
a restructuring are welcomed. Notably, I did not implement a class for
the set of blossoming trees like those for other combinatorial objects.
The reason is two-fold:
1. I am not familiar with the internal working of Sagemath, notably
metaclasses, Parent and Element, and the documentation seems to be quite
complicated.
2. I do not intend to provide exhaustive generation, which is less
efficient (not linear but quadratic in object size per object).
I may have changed a bit the idea for the second point, as when I look
at the exhaustive generation code in the iterator of
``TamariIntervalPosets_size``, its complexity is not clear. It is not
linear, but not clear whether quadratic per object. There is a
possibility that the class ``IntegerListsLex`` may provide an efficient
exhaustive generation of related lattice paths to make our bijection
more efficient for exhaustive generation.

Thanks @fchapoton for suggesting adapting my original implementation to
Sagemath.

By the way, I have not checked whether the documentation shows up
correctly in the references, because ``sage --docbuild reference html``
fails with the error
```
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/fwjmath/svn/sage/src/sage_docbuild/__main__.py", line 545,
in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/fwjmath/svn/sage/src/sage_docbuild/__main__.py", line 540,
in main
    build = getattr(builder, typ)
            ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ReferenceBuilder' object has no attribute 'html'
```

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [X] The title is concise and informative.
- [X] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [X] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#41416
Reported by: fwjmath
Reviewer(s): Frédéric Chapoton, fwjmath
vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 18, 2026
sagemathgh-41416: Implementation of blossoming trees for their bijection with Tamari intervals
    
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

This is an implementation of the bijection between blossoming trees and
Tamari intervals in the following paper:

Wenjie Fang, Éric Fusy, Philippe Nadeau, "Tamari intervals and
blossoming trees". Combinatorial Theory, Volume 5, Issue 1. doi
`10.5070/C65165015`.

It is the implementation mentioned in the paper, but with additional
"Sage-compliant" comments and tests, along with some small
restructuring.

More precisely, we provide four new classes.

- `TamariBlossomingTree`: main class that implements blossoming trees
and their bijection with Tamari intervals, along with plots and
conversion to other Sage objects.
- `TamariBlossomingTreeFactory`: a linear-time random generator of
Tamari blossoming tree.
- `SynchronizedBlossomingTreeFactory`: a linear-time random generator of
synchronized blossoming trees, which are in bijection with synchronized
Tamari intervals.
- `ModernBlossomingTreeFactory`: a linear-time random generator of
modern blossoming trees, which are in bijection with modern Tamari
intervals.

This implementation will allow users to explore Tamari intervals more
easily with our bijection. Most notably, these classes now enables an
efficient random generation of large (general, synchronized or modern)
Tamari intervals, linear in the size of generated objects. Such
generator exists for general Tamari intervals in TamariIntervalPosets,
but it goes through triangulations, thus is much slower and more
complicated. Here is a comparison of timing:
```
sage: TIP = TamariIntervalPosets(1000)
sage: %time tip = TIP.random_element()
CPU times: user 5.13 s, sys: 15 ms, total: 5.14 s
Wall time: 5.14 s
sage: TBTF = TamariBlossomingTreeFactory(1000)
sage: %time B = TBTF.random_element()
CPU times: user 118 ms, sys: 2.99 ms, total: 121 ms
Wall time: 120 ms
```
The random generation of synchronized and modern Tamari intervals is
new.

As I am not familiar with the internal structure of Sagemath, these
classes were written more like an external module. Advises and help for
a restructuring are welcomed. Notably, I did not implement a class for
the set of blossoming trees like those for other combinatorial objects.
The reason is two-fold:
1. I am not familiar with the internal working of Sagemath, notably
metaclasses, Parent and Element, and the documentation seems to be quite
complicated.
2. I do not intend to provide exhaustive generation, which is less
efficient (not linear but quadratic in object size per object).
I may have changed a bit the idea for the second point, as when I look
at the exhaustive generation code in the iterator of
``TamariIntervalPosets_size``, its complexity is not clear. It is not
linear, but not clear whether quadratic per object. There is a
possibility that the class ``IntegerListsLex`` may provide an efficient
exhaustive generation of related lattice paths to make our bijection
more efficient for exhaustive generation.

Thanks @fchapoton for suggesting adapting my original implementation to
Sagemath.

By the way, I have not checked whether the documentation shows up
correctly in the references, because ``sage --docbuild reference html``
fails with the error
```
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/fwjmath/svn/sage/src/sage_docbuild/__main__.py", line 545,
in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/fwjmath/svn/sage/src/sage_docbuild/__main__.py", line 540,
in main
    build = getattr(builder, typ)
            ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ReferenceBuilder' object has no attribute 'html'
```

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [X] The title is concise and informative.
- [X] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [X] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#41416
Reported by: fwjmath
Reviewer(s): Frédéric Chapoton, fwjmath
vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 21, 2026
sagemathgh-41416: Implementation of blossoming trees for their bijection with Tamari intervals
    
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

This is an implementation of the bijection between blossoming trees and
Tamari intervals in the following paper:

Wenjie Fang, Éric Fusy, Philippe Nadeau, "Tamari intervals and
blossoming trees". Combinatorial Theory, Volume 5, Issue 1. doi
`10.5070/C65165015`.

It is the implementation mentioned in the paper, but with additional
"Sage-compliant" comments and tests, along with some small
restructuring.

More precisely, we provide four new classes.

- `TamariBlossomingTree`: main class that implements blossoming trees
and their bijection with Tamari intervals, along with plots and
conversion to other Sage objects.
- `TamariBlossomingTreeFactory`: a linear-time random generator of
Tamari blossoming tree.
- `SynchronizedBlossomingTreeFactory`: a linear-time random generator of
synchronized blossoming trees, which are in bijection with synchronized
Tamari intervals.
- `ModernBlossomingTreeFactory`: a linear-time random generator of
modern blossoming trees, which are in bijection with modern Tamari
intervals.

This implementation will allow users to explore Tamari intervals more
easily with our bijection. Most notably, these classes now enables an
efficient random generation of large (general, synchronized or modern)
Tamari intervals, linear in the size of generated objects. Such
generator exists for general Tamari intervals in TamariIntervalPosets,
but it goes through triangulations, thus is much slower and more
complicated. Here is a comparison of timing:
```
sage: TIP = TamariIntervalPosets(1000)
sage: %time tip = TIP.random_element()
CPU times: user 5.13 s, sys: 15 ms, total: 5.14 s
Wall time: 5.14 s
sage: TBTF = TamariBlossomingTreeFactory(1000)
sage: %time B = TBTF.random_element()
CPU times: user 118 ms, sys: 2.99 ms, total: 121 ms
Wall time: 120 ms
```
The random generation of synchronized and modern Tamari intervals is
new.

As I am not familiar with the internal structure of Sagemath, these
classes were written more like an external module. Advises and help for
a restructuring are welcomed. Notably, I did not implement a class for
the set of blossoming trees like those for other combinatorial objects.
The reason is two-fold:
1. I am not familiar with the internal working of Sagemath, notably
metaclasses, Parent and Element, and the documentation seems to be quite
complicated.
2. I do not intend to provide exhaustive generation, which is less
efficient (not linear but quadratic in object size per object).
I may have changed a bit the idea for the second point, as when I look
at the exhaustive generation code in the iterator of
``TamariIntervalPosets_size``, its complexity is not clear. It is not
linear, but not clear whether quadratic per object. There is a
possibility that the class ``IntegerListsLex`` may provide an efficient
exhaustive generation of related lattice paths to make our bijection
more efficient for exhaustive generation.

Thanks @fchapoton for suggesting adapting my original implementation to
Sagemath.

By the way, I have not checked whether the documentation shows up
correctly in the references, because ``sage --docbuild reference html``
fails with the error
```
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/fwjmath/svn/sage/src/sage_docbuild/__main__.py", line 545,
in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/fwjmath/svn/sage/src/sage_docbuild/__main__.py", line 540,
in main
    build = getattr(builder, typ)
            ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ReferenceBuilder' object has no attribute 'html'
```

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [X] The title is concise and informative.
- [X] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [X] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#41416
Reported by: fwjmath
Reviewer(s): Frédéric Chapoton, fwjmath
@vbraun vbraun merged commit 6ed85aa into sagemath:develop Mar 22, 2026
37 of 41 checks passed
@fwjmath fwjmath deleted the blossoming branch March 24, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants