Tamari Interval-posets¶
This module implements Tamari interval-posets: combinatorial objects which
represent intervals of the Tamari order. They have been introduced in
[CP2015] and allow for many combinatorial operations on Tamari intervals.
In particular, they are linked to DyckWords and BinaryTrees.
An introduction into Tamari interval-posets is given in Chapter 7
of [Pons2013].
The Tamari lattice can be defined as a lattice structure on either of several classes of Catalan objects, especially binary trees and Dyck paths [Tam1962] [HT1972] [Sta-EC2]. An interval can be seen as a pair of comparable elements. The number of intervals has been given in [Cha2008].
AUTHORS:
- Viviane Pons 2014: initial implementation 
- Frédéric Chapoton 2014: review 
- Darij Grinberg 2014: review 
- Travis Scrimshaw 2014: review 
- sage.combinat.interval_posets.TIP[source]¶
- alias of - TamariIntervalPoset
- class sage.combinat.interval_posets.TamariIntervalPoset(parent, size, relations=None, check=True)[source]¶
- Bases: - Element- The class of Tamari interval-posets. - An interval-poset is a labelled poset of size \(n\), with labels \(1, 2, \ldots, n\), satisfying the following conditions: - if \(a < c\) (as integers) and \(a\) precedes \(c\) in the poset, then, for all \(b\) such that \(a < b < c\), \(b\) precedes \(c\), 
- if \(a < c\) (as integers) and \(c\) precedes \(a\) in the poset, then, for all \(b\) such that \(a < b < c\), \(b\) precedes \(a\). 
 - We use the word “precedes” here to distinguish the poset order and the natural order on numbers. “Precedes” means “is smaller than with respect to the poset structure”; this does not imply a covering relation. - Interval-posets of size \(n\) are in bijection with intervals of the Tamari lattice of binary trees of size \(n\). Specifically, if \(P\) is an interval-poset of size \(n\), then the set of linear extensions of \(P\) (as permutations in \(S_n\)) is an interval in the right weak order (see - permutohedron_lequal()), and is in fact the preimage of an interval in the Tamari lattice (of binary trees of size \(n\)) under the operation which sends a permutation to its right-to-left binary search tree (- binary_search_tree()with the- left_to_rightvariable set to- False) without its labelling.- INPUT: - size– integer; the size of the interval-posets (number of vertices)
- relations– list (or tuple) of pairs- (a,b)(themselves lists or tuples), each representing a relation of the form ‘\(a\) precedes \(b\)’ in the poset
- check– boolean (default:- True); whether to check the interval-poset condition or not
 - Warning - The - relationsinput can be a list or tuple, but not an iterator (nor should its entries be iterators).- NOTATION: - Here and in the following, the signs \(<\) and \(>\) always refer to the natural ordering on integers, whereas the word “precedes” refers to the order of the interval-poset. “Minimal” and “maximal” refer to the natural ordering on integers. - The increasing relations of an interval-poset \(P\) mean the pairs \((a, b)\) of elements of \(P\) such that \(a < b\) as integers and \(a\) precedes \(b\) in \(P\). The initial forest of \(P\) is the poset obtained by imposing (only) the increasing relations on the ground set of \(P\). It is a sub-interval poset of \(P\), and is a forest with its roots on top. This forest is usually given the structure of a planar forest by ordering brother nodes by their labels; it then has the property that if its nodes are traversed in post-order (see - post_order_traversal(), and traverse the trees of the forest from left to right as well), then the labels encountered are \(1, 2, \ldots, n\) in this order.- The decreasing relations of an interval-poset \(P\) mean the pairs \((a, b)\) of elements of \(P\) such that \(b < a\) as integers and \(a\) precedes \(b\) in \(P\). The final forest of \(P\) is the poset obtained by imposing (only) the decreasing relations on the ground set of \(P\). It is a sub-interval poset of \(P\), and is a forest with its roots on top. This forest is usually given the structure of a planar forest by ordering brother nodes by their labels; it then has the property that if its nodes are traversed in pre-order (see - pre_order_traversal(), and traverse the trees of the forest from left to right as well), then the labels encountered are \(1, 2, \ldots, n\) in this order.- EXAMPLES: - sage: TamariIntervalPoset(0,[]) The Tamari interval of size 0 induced by relations [] sage: TamariIntervalPoset(3,[]) The Tamari interval of size 3 induced by relations [] sage: TamariIntervalPoset(3,[(1,2)]) The Tamari interval of size 3 induced by relations [(1, 2)] sage: TamariIntervalPoset(3,[(1,2),(2,3)]) The Tamari interval of size 3 induced by relations [(1, 2), (2, 3)] sage: TamariIntervalPoset(3,[(1,2),(2,3),(1,3)]) The Tamari interval of size 3 induced by relations [(1, 2), (2, 3)] sage: TamariIntervalPoset(3,[(1,2),(3,2)]) The Tamari interval of size 3 induced by relations [(1, 2), (3, 2)] sage: TamariIntervalPoset(3,[[1,2],[2,3]]) The Tamari interval of size 3 induced by relations [(1, 2), (2, 3)] sage: TamariIntervalPoset(3,[[1,2],[2,3],[1,2],[1,3]]) The Tamari interval of size 3 induced by relations [(1, 2), (2, 3)] sage: TamariIntervalPoset(3,[(3,4)]) Traceback (most recent call last): ... ValueError: the relations do not correspond to the size of the poset sage: TamariIntervalPoset(2,[(2,1),(1,2)]) Traceback (most recent call last): ... ValueError: The graph is not directed acyclic sage: TamariIntervalPoset(3,[(1,3)]) Traceback (most recent call last): ... ValueError: this does not satisfy the Tamari interval-poset condition - >>> from sage.all import * >>> TamariIntervalPoset(Integer(0),[]) The Tamari interval of size 0 induced by relations [] >>> TamariIntervalPoset(Integer(3),[]) The Tamari interval of size 3 induced by relations [] >>> TamariIntervalPoset(Integer(3),[(Integer(1),Integer(2))]) The Tamari interval of size 3 induced by relations [(1, 2)] >>> TamariIntervalPoset(Integer(3),[(Integer(1),Integer(2)),(Integer(2),Integer(3))]) The Tamari interval of size 3 induced by relations [(1, 2), (2, 3)] >>> TamariIntervalPoset(Integer(3),[(Integer(1),Integer(2)),(Integer(2),Integer(3)),(Integer(1),Integer(3))]) The Tamari interval of size 3 induced by relations [(1, 2), (2, 3)] >>> TamariIntervalPoset(Integer(3),[(Integer(1),Integer(2)),(Integer(3),Integer(2))]) The Tamari interval of size 3 induced by relations [(1, 2), (3, 2)] >>> TamariIntervalPoset(Integer(3),[[Integer(1),Integer(2)],[Integer(2),Integer(3)]]) The Tamari interval of size 3 induced by relations [(1, 2), (2, 3)] >>> TamariIntervalPoset(Integer(3),[[Integer(1),Integer(2)],[Integer(2),Integer(3)],[Integer(1),Integer(2)],[Integer(1),Integer(3)]]) The Tamari interval of size 3 induced by relations [(1, 2), (2, 3)] >>> TamariIntervalPoset(Integer(3),[(Integer(3),Integer(4))]) Traceback (most recent call last): ... ValueError: the relations do not correspond to the size of the poset >>> TamariIntervalPoset(Integer(2),[(Integer(2),Integer(1)),(Integer(1),Integer(2))]) Traceback (most recent call last): ... ValueError: The graph is not directed acyclic >>> TamariIntervalPoset(Integer(3),[(Integer(1),Integer(3))]) Traceback (most recent call last): ... ValueError: this does not satisfy the Tamari interval-poset condition - It is also possible to transform a poset directly into an interval-poset: - sage: TIP = TamariIntervalPosets() sage: p = Poset(([1,2,3], [(1,2)])) sage: TIP(p) The Tamari interval of size 3 induced by relations [(1, 2)] sage: TIP(Poset({1: []})) The Tamari interval of size 1 induced by relations [] sage: TIP(Poset({})) The Tamari interval of size 0 induced by relations [] - >>> from sage.all import * >>> TIP = TamariIntervalPosets() >>> p = Poset(([Integer(1),Integer(2),Integer(3)], [(Integer(1),Integer(2))])) >>> TIP(p) The Tamari interval of size 3 induced by relations [(1, 2)] >>> TIP(Poset({Integer(1): []})) The Tamari interval of size 1 induced by relations [] >>> TIP(Poset({})) The Tamari interval of size 0 induced by relations [] - binary_trees()[source]¶
- Return an iterator on all the binary trees in the interval represented by - self.- See also - EXAMPLES: - sage: list(TamariIntervalPoset(4,[(2,4),(3,4),(2,1),(3,1)]).binary_trees()) [[., [[., [., .]], .]], [[., [., [., .]]], .], [., [[[., .], .], .]], [[., [[., .], .]], .]] sage: set(TamariIntervalPoset(4,[]).binary_trees()) == set(BinaryTrees(4)) True - >>> from sage.all import * >>> list(TamariIntervalPoset(Integer(4),[(Integer(2),Integer(4)),(Integer(3),Integer(4)),(Integer(2),Integer(1)),(Integer(3),Integer(1))]).binary_trees()) [[., [[., [., .]], .]], [[., [., [., .]]], .], [., [[[., .], .], .]], [[., [[., .], .]], .]] >>> set(TamariIntervalPoset(Integer(4),[]).binary_trees()) == set(BinaryTrees(Integer(4))) True 
 - complement()[source]¶
- Return the complement of the interval-poset - self.- If \(P\) is a Tamari interval-poset of size \(n\), then the complement of \(P\) is defined as the interval-poset \(Q\) whose base set is \([n] = \{1, 2, \ldots, n\}\) (just as for \(P\)), but whose order relation has \(a\) precede \(b\) if and only if \(n + 1 - a\) precedes \(n + 1 - b\) in \(P\). - In terms of the Tamari lattice, the complement is the symmetric of - self. It is formed from the left-right symmetrized of the binary trees of the interval (switching left and right subtrees, see- left_right_symmetry()). In particular, initial intervals are sent to final intervals and vice-versa.- EXAMPLES: - sage: TamariIntervalPoset(3, [(2, 1), (3, 1)]).complement() The Tamari interval of size 3 induced by relations [(1, 3), (2, 3)] sage: TamariIntervalPoset(0, []).complement() The Tamari interval of size 0 induced by relations [] sage: ip = TamariIntervalPoset(4, [(1, 2), (2, 4), (3, 4)]) sage: ip.complement() == TamariIntervalPoset(4, [(2, 1), (3, 1), (4, 3)]) True sage: ip.lower_binary_tree() == ip.complement().upper_binary_tree().left_right_symmetry() True sage: ip.upper_binary_tree() == ip.complement().lower_binary_tree().left_right_symmetry() True sage: ip.is_initial_interval() True sage: ip.complement().is_final_interval() True - >>> from sage.all import * >>> TamariIntervalPoset(Integer(3), [(Integer(2), Integer(1)), (Integer(3), Integer(1))]).complement() The Tamari interval of size 3 induced by relations [(1, 3), (2, 3)] >>> TamariIntervalPoset(Integer(0), []).complement() The Tamari interval of size 0 induced by relations [] >>> ip = TamariIntervalPoset(Integer(4), [(Integer(1), Integer(2)), (Integer(2), Integer(4)), (Integer(3), Integer(4))]) >>> ip.complement() == TamariIntervalPoset(Integer(4), [(Integer(2), Integer(1)), (Integer(3), Integer(1)), (Integer(4), Integer(3))]) True >>> ip.lower_binary_tree() == ip.complement().upper_binary_tree().left_right_symmetry() True >>> ip.upper_binary_tree() == ip.complement().lower_binary_tree().left_right_symmetry() True >>> ip.is_initial_interval() True >>> ip.complement().is_final_interval() True 
 - contains_binary_tree(binary_tree)[source]¶
- Return whether the interval represented by - selfcontains the binary tree- binary_tree.- INPUT: - binary_tree– a binary tree
 - See also - EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(2,4),(3,4),(2,1),(3,1)]) sage: ip.contains_binary_tree(BinaryTree([[None,[None,[]]],None])) True sage: ip.contains_binary_tree(BinaryTree([None,[[[],None],None]])) True sage: ip.contains_binary_tree(BinaryTree([[],[[],None]])) False sage: ip.contains_binary_tree(ip.lower_binary_tree()) True sage: ip.contains_binary_tree(ip.upper_binary_tree()) True sage: all(ip.contains_binary_tree(bt) for bt in ip.binary_trees()) True - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(2),Integer(4)),(Integer(3),Integer(4)),(Integer(2),Integer(1)),(Integer(3),Integer(1))]) >>> ip.contains_binary_tree(BinaryTree([[None,[None,[]]],None])) True >>> ip.contains_binary_tree(BinaryTree([None,[[[],None],None]])) True >>> ip.contains_binary_tree(BinaryTree([[],[[],None]])) False >>> ip.contains_binary_tree(ip.lower_binary_tree()) True >>> ip.contains_binary_tree(ip.upper_binary_tree()) True >>> all(ip.contains_binary_tree(bt) for bt in ip.binary_trees()) True 
 - contains_dyck_word(dyck_word)[source]¶
- Return whether the interval represented by - selfcontains the Dyck word- dyck_word.- INPUT: - dyck_word– a Dyck word
 - See also - EXAMPLES: - sage: # needs sage.combinat sage: ip = TamariIntervalPoset(4,[(2,4),(3,4),(2,1),(3,1)]) sage: ip.contains_dyck_word(DyckWord([1,1,1,0,0,0,1,0])) True sage: ip.contains_dyck_word(DyckWord([1,1,0,1,0,1,0,0])) True sage: ip.contains_dyck_word(DyckWord([1,0,1,1,0,1,0,0])) False sage: ip.contains_dyck_word(ip.lower_dyck_word()) True sage: ip.contains_dyck_word(ip.upper_dyck_word()) True sage: all(ip.contains_dyck_word(bt) for bt in ip.dyck_words()) True - >>> from sage.all import * >>> # needs sage.combinat >>> ip = TamariIntervalPoset(Integer(4),[(Integer(2),Integer(4)),(Integer(3),Integer(4)),(Integer(2),Integer(1)),(Integer(3),Integer(1))]) >>> ip.contains_dyck_word(DyckWord([Integer(1),Integer(1),Integer(1),Integer(0),Integer(0),Integer(0),Integer(1),Integer(0)])) True >>> ip.contains_dyck_word(DyckWord([Integer(1),Integer(1),Integer(0),Integer(1),Integer(0),Integer(1),Integer(0),Integer(0)])) True >>> ip.contains_dyck_word(DyckWord([Integer(1),Integer(0),Integer(1),Integer(1),Integer(0),Integer(1),Integer(0),Integer(0)])) False >>> ip.contains_dyck_word(ip.lower_dyck_word()) True >>> ip.contains_dyck_word(ip.upper_dyck_word()) True >>> all(ip.contains_dyck_word(bt) for bt in ip.dyck_words()) True 
 - contains_interval(other)[source]¶
- Return whether the interval represented by - otheris contained in- selfas an interval of the Tamari lattice.- In terms of interval-posets, it means that all relations of - selfare relations of- other.- INPUT: - other– an interval-poset
 - EXAMPLES: - sage: ip1 = TamariIntervalPoset(4,[(1,2),(2,3),(4,3)]) sage: ip2 = TamariIntervalPoset(4,[(2,3)]) sage: ip2.contains_interval(ip1) True sage: ip3 = TamariIntervalPoset(4,[(2,1)]) sage: ip2.contains_interval(ip3) False sage: ip4 = TamariIntervalPoset(3,[(2,3)]) sage: ip2.contains_interval(ip4) False - >>> from sage.all import * >>> ip1 = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3)),(Integer(4),Integer(3))]) >>> ip2 = TamariIntervalPoset(Integer(4),[(Integer(2),Integer(3))]) >>> ip2.contains_interval(ip1) True >>> ip3 = TamariIntervalPoset(Integer(4),[(Integer(2),Integer(1))]) >>> ip2.contains_interval(ip3) False >>> ip4 = TamariIntervalPoset(Integer(3),[(Integer(2),Integer(3))]) >>> ip2.contains_interval(ip4) False 
 - cubical_coordinates()[source]¶
- Return the cubical coordinates of - self.- This provides a fast and natural way to order the set of interval-posets of a given size. - EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(1,2),(2,3)]) sage: ip.cubical_coordinates() (-1, -2, 0) - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3))]) >>> ip.cubical_coordinates() (-1, -2, 0) - REFERENCES: 
 - decomposition_to_triple()[source]¶
- Decompose an interval-poset into a triple ( - left,- right,- r).- For the inverse method, see - TamariIntervalPosets.recomposition_from_triple().- OUTPUT: - a triple ( - left,- right,- r) where- leftand- rightare interval-posets and- r(an integer) is the parameter of the decomposition.- EXAMPLES: - sage: tip = TamariIntervalPoset(8, [(1,2), (2,4), (3,4), (6,7), ....: (3,2), (5,4), (6,4), (8,7)]) sage: tip.decomposition_to_triple() (The Tamari interval of size 3 induced by relations [(1, 2), (3, 2)], The Tamari interval of size 4 induced by relations [(2, 3), (4, 3)], 2) sage: tip == TamariIntervalPosets.recomposition_from_triple( ....: *tip.decomposition_to_triple()) True - >>> from sage.all import * >>> tip = TamariIntervalPoset(Integer(8), [(Integer(1),Integer(2)), (Integer(2),Integer(4)), (Integer(3),Integer(4)), (Integer(6),Integer(7)), ... (Integer(3),Integer(2)), (Integer(5),Integer(4)), (Integer(6),Integer(4)), (Integer(8),Integer(7))]) >>> tip.decomposition_to_triple() (The Tamari interval of size 3 induced by relations [(1, 2), (3, 2)], The Tamari interval of size 4 induced by relations [(2, 3), (4, 3)], 2) >>> tip == TamariIntervalPosets.recomposition_from_triple( ... *tip.decomposition_to_triple()) True - REFERENCES: 
 - decreasing_children(v)[source]¶
- Return the children of - vin the final forest of- self.- INPUT: - v– integer representing a vertex of- self(between 1 and- size)
 - OUTPUT: - The list of all children of - vin the final forest of- self, in increasing order.- EXAMPLES: - sage: ip = TamariIntervalPoset(6,[(3,2),(4,3),(5,2),(6,5),(1,2),(3,5),(4,5)]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] sage: ip.decreasing_children(2) [3, 5] sage: ip.decreasing_children(3) [4] sage: ip.decreasing_children(1) [] - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(6),[(Integer(3),Integer(2)),(Integer(4),Integer(3)),(Integer(5),Integer(2)),(Integer(6),Integer(5)),(Integer(1),Integer(2)),(Integer(3),Integer(5)),(Integer(4),Integer(5))]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] >>> ip.decreasing_children(Integer(2)) [3, 5] >>> ip.decreasing_children(Integer(3)) [4] >>> ip.decreasing_children(Integer(1)) [] 
 - decreasing_cover_relations()[source]¶
- Return the cover relations of the final forest of - self.- This is the poset formed by keeping only the relations of the form \(a\) precedes \(b\) with \(a > b\). - The final forest of - selfis a forest with its roots being on top. It is also called the decreasing poset of- self.- Warning - This method computes the cover relations of the final forest. This is not identical with the cover relations of - selfwhich happen to be decreasing!- See also - EXAMPLES: - sage: TamariIntervalPoset(4,[(2,1),(3,2),(3,4),(4,2)]).decreasing_cover_relations() [(4, 2), (3, 2), (2, 1)] sage: TamariIntervalPoset(4,[(2,1),(4,3),(2,3)]).decreasing_cover_relations() [(4, 3), (2, 1)] sage: TamariIntervalPoset(3,[(2,1),(3,1),(3,2)]).decreasing_cover_relations() [(3, 2), (2, 1)] - >>> from sage.all import * >>> TamariIntervalPoset(Integer(4),[(Integer(2),Integer(1)),(Integer(3),Integer(2)),(Integer(3),Integer(4)),(Integer(4),Integer(2))]).decreasing_cover_relations() [(4, 2), (3, 2), (2, 1)] >>> TamariIntervalPoset(Integer(4),[(Integer(2),Integer(1)),(Integer(4),Integer(3)),(Integer(2),Integer(3))]).decreasing_cover_relations() [(4, 3), (2, 1)] >>> TamariIntervalPoset(Integer(3),[(Integer(2),Integer(1)),(Integer(3),Integer(1)),(Integer(3),Integer(2))]).decreasing_cover_relations() [(3, 2), (2, 1)] 
 - decreasing_parent(v)[source]¶
- Return the vertex parent of - vin the final forest of- self.- This is the highest (as integer!) vertex \(a < v\) such that - vprecedes- a. If there is no such vertex (that is, \(v\) is a decreasing root), then- Noneis returned.- INPUT: - v– integer representing a vertex of- self(between 1 and- size)
 - EXAMPLES: - sage: ip = TamariIntervalPoset(6,[(3,2),(4,3),(5,2),(6,5),(1,2),(3,5),(4,5)]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] sage: ip.decreasing_parent(4) 3 sage: ip.decreasing_parent(3) 2 sage: ip.decreasing_parent(5) 2 sage: ip.decreasing_parent(2) is None True - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(6),[(Integer(3),Integer(2)),(Integer(4),Integer(3)),(Integer(5),Integer(2)),(Integer(6),Integer(5)),(Integer(1),Integer(2)),(Integer(3),Integer(5)),(Integer(4),Integer(5))]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] >>> ip.decreasing_parent(Integer(4)) 3 >>> ip.decreasing_parent(Integer(3)) 2 >>> ip.decreasing_parent(Integer(5)) 2 >>> ip.decreasing_parent(Integer(2)) is None True 
 - decreasing_roots()[source]¶
- Return the root vertices of the final forest of - self.- These are the vertices \(b\) such that there is no \(a < b\) with \(b\) preceding \(a\). - OUTPUT: - The list of all roots of the final forest of - self, in increasing order.- EXAMPLES: - sage: ip = TamariIntervalPoset(6,[(3,2),(4,3),(5,2),(6,5),(1,2),(3,5),(4,5)]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] sage: ip.decreasing_roots() [1, 2] sage: ip.final_forest().decreasing_roots() [1, 2] - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(6),[(Integer(3),Integer(2)),(Integer(4),Integer(3)),(Integer(5),Integer(2)),(Integer(6),Integer(5)),(Integer(1),Integer(2)),(Integer(3),Integer(5)),(Integer(4),Integer(5))]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] >>> ip.decreasing_roots() [1, 2] >>> ip.final_forest().decreasing_roots() [1, 2] 
 - dyck_words()[source]¶
- Return an iterator on all the Dyck words in the interval represented by - self.- EXAMPLES: - sage: list(TamariIntervalPoset(4,[(2,4),(3,4),(2,1),(3,1)]).dyck_words()) # needs sage.combinat [[1, 1, 1, 0, 0, 1, 0, 0], [1, 1, 1, 0, 0, 0, 1, 0], [1, 1, 0, 1, 0, 1, 0, 0], [1, 1, 0, 1, 0, 0, 1, 0]] sage: set(TamariIntervalPoset(4,[]).dyck_words()) == set(DyckWords(4)) # needs sage.combinat True - >>> from sage.all import * >>> list(TamariIntervalPoset(Integer(4),[(Integer(2),Integer(4)),(Integer(3),Integer(4)),(Integer(2),Integer(1)),(Integer(3),Integer(1))]).dyck_words()) # needs sage.combinat [[1, 1, 1, 0, 0, 1, 0, 0], [1, 1, 1, 0, 0, 0, 1, 0], [1, 1, 0, 1, 0, 1, 0, 0], [1, 1, 0, 1, 0, 0, 1, 0]] >>> set(TamariIntervalPoset(Integer(4),[]).dyck_words()) == set(DyckWords(Integer(4))) # needs sage.combinat True 
 - factor()[source]¶
- Return the unique decomposition as a list of connected components. - EXAMPLES: - sage: factor(TamariIntervalPoset(2,[])) # indirect doctest [The Tamari interval of size 1 induced by relations [], The Tamari interval of size 1 induced by relations []] - >>> from sage.all import * >>> factor(TamariIntervalPoset(Integer(2),[])) # indirect doctest [The Tamari interval of size 1 induced by relations [], The Tamari interval of size 1 induced by relations []] - See also 
 - final_forest()[source]¶
- Return the final forest of - self, i.e., the interval-poset formed with only the decreasing relations of- self.- See also - EXAMPLES: - sage: TamariIntervalPoset(4,[(2,1),(3,2),(3,4),(4,2)]).final_forest() The Tamari interval of size 4 induced by relations [(4, 2), (3, 2), (2, 1)] sage: ip = TamariIntervalPoset(3,[(2,1),(3,1)]) sage: ip.final_forest() == ip True - >>> from sage.all import * >>> TamariIntervalPoset(Integer(4),[(Integer(2),Integer(1)),(Integer(3),Integer(2)),(Integer(3),Integer(4)),(Integer(4),Integer(2))]).final_forest() The Tamari interval of size 4 induced by relations [(4, 2), (3, 2), (2, 1)] >>> ip = TamariIntervalPoset(Integer(3),[(Integer(2),Integer(1)),(Integer(3),Integer(1))]) >>> ip.final_forest() == ip True 
 - ge(e1, e2)[source]¶
- Return whether - e2precedes or equals- e1in- self.- EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(1,2),(2,3)]) sage: ip.ge(2,1) True sage: ip.ge(3,1) True sage: ip.ge(3,2) True sage: ip.ge(4,3) False sage: ip.ge(1,1) True - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3))]) >>> ip.ge(Integer(2),Integer(1)) True >>> ip.ge(Integer(3),Integer(1)) True >>> ip.ge(Integer(3),Integer(2)) True >>> ip.ge(Integer(4),Integer(3)) False >>> ip.ge(Integer(1),Integer(1)) True 
 - grafting_tree()[source]¶
- Return the grafting tree of the interval-poset. - For the inverse method, see - TamariIntervalPosets.from_grafting_tree().- EXAMPLES: - sage: tip = TamariIntervalPoset(8, [(1,2), (2,4), (3,4), (6,7), ....: (3,2), (5,4), (6,4), (8,7)]) sage: tip.grafting_tree() 2[1[0[., .], 0[., .]], 0[., 1[0[., .], 0[., .]]]] sage: tip == TamariIntervalPosets.from_grafting_tree(tip.grafting_tree()) True - >>> from sage.all import * >>> tip = TamariIntervalPoset(Integer(8), [(Integer(1),Integer(2)), (Integer(2),Integer(4)), (Integer(3),Integer(4)), (Integer(6),Integer(7)), ... (Integer(3),Integer(2)), (Integer(5),Integer(4)), (Integer(6),Integer(4)), (Integer(8),Integer(7))]) >>> tip.grafting_tree() 2[1[0[., .], 0[., .]], 0[., 1[0[., .], 0[., .]]]] >>> tip == TamariIntervalPosets.from_grafting_tree(tip.grafting_tree()) True - REFERENCES: 
 - gt(e1, e2)[source]¶
- Return whether - e2strictly precedes- e1in- self.- EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(1,2),(2,3)]) sage: ip.gt(2,1) True sage: ip.gt(3,1) True sage: ip.gt(3,2) True sage: ip.gt(4,3) False sage: ip.gt(1,1) False - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3))]) >>> ip.gt(Integer(2),Integer(1)) True >>> ip.gt(Integer(3),Integer(1)) True >>> ip.gt(Integer(3),Integer(2)) True >>> ip.gt(Integer(4),Integer(3)) False >>> ip.gt(Integer(1),Integer(1)) False 
 - increasing_children(v)[source]¶
- Return the children of - vin the initial forest of- self.- INPUT: - v– integer representing a vertex of- self(between 1 and- size)
 - OUTPUT: - The list of all children of - vin the initial forest of- self, in decreasing order.- EXAMPLES: - sage: ip = TamariIntervalPoset(6,[(3,2),(4,3),(5,2),(6,5),(1,2),(3,5),(4,5)]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] sage: ip.increasing_children(2) [1] sage: ip.increasing_children(5) [4, 3] sage: ip.increasing_children(1) [] - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(6),[(Integer(3),Integer(2)),(Integer(4),Integer(3)),(Integer(5),Integer(2)),(Integer(6),Integer(5)),(Integer(1),Integer(2)),(Integer(3),Integer(5)),(Integer(4),Integer(5))]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] >>> ip.increasing_children(Integer(2)) [1] >>> ip.increasing_children(Integer(5)) [4, 3] >>> ip.increasing_children(Integer(1)) [] 
 - increasing_cover_relations()[source]¶
- Return the cover relations of the initial forest of - self.- This is the poset formed by keeping only the relations of the form \(a\) precedes \(b\) with \(a < b\). - The initial forest of - selfis a forest with its roots being on top. It is also called the increasing poset of- self.- Warning - This method computes the cover relations of the initial forest. This is not identical with the cover relations of - selfwhich happen to be increasing!- See also - EXAMPLES: - sage: TamariIntervalPoset(4,[(1,2),(3,2),(2,4),(3,4)]).increasing_cover_relations() [(1, 2), (2, 4), (3, 4)] sage: TamariIntervalPoset(3,[(1,2),(1,3),(2,3)]).increasing_cover_relations() [(1, 2), (2, 3)] - >>> from sage.all import * >>> TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(3),Integer(2)),(Integer(2),Integer(4)),(Integer(3),Integer(4))]).increasing_cover_relations() [(1, 2), (2, 4), (3, 4)] >>> TamariIntervalPoset(Integer(3),[(Integer(1),Integer(2)),(Integer(1),Integer(3)),(Integer(2),Integer(3))]).increasing_cover_relations() [(1, 2), (2, 3)] 
 - increasing_parent(v)[source]¶
- Return the vertex parent of - vin the initial forest of- self.- This is the lowest (as integer!) vertex \(b > v\) such that \(v\) precedes \(b\). If there is no such vertex (that is, \(v\) is an increasing root), then - Noneis returned.- INPUT: - v– integer representing a vertex of- self(between 1 and- size)
 - EXAMPLES: - sage: ip = TamariIntervalPoset(6,[(3,2),(4,3),(5,2),(6,5),(1,2),(3,5),(4,5)]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] sage: ip.increasing_parent(1) 2 sage: ip.increasing_parent(3) 5 sage: ip.increasing_parent(4) 5 sage: ip.increasing_parent(5) is None True - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(6),[(Integer(3),Integer(2)),(Integer(4),Integer(3)),(Integer(5),Integer(2)),(Integer(6),Integer(5)),(Integer(1),Integer(2)),(Integer(3),Integer(5)),(Integer(4),Integer(5))]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] >>> ip.increasing_parent(Integer(1)) 2 >>> ip.increasing_parent(Integer(3)) 5 >>> ip.increasing_parent(Integer(4)) 5 >>> ip.increasing_parent(Integer(5)) is None True 
 - increasing_roots()[source]¶
- Return the root vertices of the initial forest of - self.- These are the vertices \(a\) of - selfsuch that there is no \(b > a\) with \(a\) precedes \(b\).- OUTPUT: - The list of all roots of the initial forest of - self, in decreasing order.- EXAMPLES: - sage: ip = TamariIntervalPoset(6,[(3,2),(4,3),(5,2),(6,5),(1,2),(3,5),(4,5)]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] sage: ip.increasing_roots() [6, 5, 2] sage: ip.initial_forest().increasing_roots() [6, 5, 2] - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(6),[(Integer(3),Integer(2)),(Integer(4),Integer(3)),(Integer(5),Integer(2)),(Integer(6),Integer(5)),(Integer(1),Integer(2)),(Integer(3),Integer(5)),(Integer(4),Integer(5))]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] >>> ip.increasing_roots() [6, 5, 2] >>> ip.initial_forest().increasing_roots() [6, 5, 2] 
 - initial_forest()[source]¶
- Return the initial forest of - self, i.e., the interval-poset formed from only the increasing relations of- self.- See also - EXAMPLES: - sage: TamariIntervalPoset(4,[(1,2),(3,2),(2,4),(3,4)]).initial_forest() The Tamari interval of size 4 induced by relations [(1, 2), (2, 4), (3, 4)] sage: ip = TamariIntervalPoset(4,[(1,2),(2,3)]) sage: ip.initial_forest() == ip True - >>> from sage.all import * >>> TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(3),Integer(2)),(Integer(2),Integer(4)),(Integer(3),Integer(4))]).initial_forest() The Tamari interval of size 4 induced by relations [(1, 2), (2, 4), (3, 4)] >>> ip = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3))]) >>> ip.initial_forest() == ip True 
 - insertion(i)[source]¶
- Return the Tamari insertion of an integer \(i\) into the interval-poset - self.- If \(P\) is a Tamari interval-poset of size \(n\) and \(i\) is an integer with \(1 \leq i \leq n+1\), then the Tamari insertion of \(i\) into \(P\) is defined as the Tamari interval-poset of size \(n+1\) which corresponds to the interval \([C_1, C_2]\) on the Tamari lattice, where the binary trees \(C_1\) and \(C_2\) are defined as follows: We write the interval-poset \(P\) as \([B_1, B_2]\) for two binary trees \(B_1\) and \(B_2\). We label the vertices of each of these two trees with the integers \(1, 2, \ldots, i-1, i+1, i+2, \ldots, n+1\) in such a way that the trees are binary search trees (this labelling is unique). Then, we insert \(i\) into each of these trees (in the way as explained in - binary_search_insert()). The shapes of the resulting two trees are denoted \(C_1\) and \(C_2\).- An alternative way to construct the insertion of \(i\) into \(P\) is by relabeling each vertex \(u\) of \(P\) satisfying \(u \geq i\) (as integers) as \(u+1\), and then adding a vertex \(i\) which should precede \(i-1\) and \(i+1\). - Todo - To study this, it would be more natural to define interval-posets on arbitrary ordered sets rather than just on \(\{1, 2, \ldots, n\}\). - EXAMPLES: - sage: ip = TamariIntervalPoset(4, [(2, 3), (4, 3)]); ip The Tamari interval of size 4 induced by relations [(2, 3), (4, 3)] sage: ip.insertion(1) The Tamari interval of size 5 induced by relations [(1, 2), (3, 4), (5, 4)] sage: ip.insertion(2) The Tamari interval of size 5 induced by relations [(2, 3), (3, 4), (5, 4), (2, 1)] sage: ip.insertion(3) The Tamari interval of size 5 induced by relations [(2, 4), (3, 4), (5, 4), (3, 2)] sage: ip.insertion(4) The Tamari interval of size 5 induced by relations [(2, 3), (4, 5), (5, 3), (4, 3)] sage: ip.insertion(5) The Tamari interval of size 5 induced by relations [(2, 3), (5, 4), (4, 3)] sage: ip = TamariIntervalPoset(0, []) sage: ip.insertion(1) The Tamari interval of size 1 induced by relations [] sage: ip = TamariIntervalPoset(1, []) sage: ip.insertion(1) The Tamari interval of size 2 induced by relations [(1, 2)] sage: ip.insertion(2) The Tamari interval of size 2 induced by relations [(2, 1)] - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4), [(Integer(2), Integer(3)), (Integer(4), Integer(3))]); ip The Tamari interval of size 4 induced by relations [(2, 3), (4, 3)] >>> ip.insertion(Integer(1)) The Tamari interval of size 5 induced by relations [(1, 2), (3, 4), (5, 4)] >>> ip.insertion(Integer(2)) The Tamari interval of size 5 induced by relations [(2, 3), (3, 4), (5, 4), (2, 1)] >>> ip.insertion(Integer(3)) The Tamari interval of size 5 induced by relations [(2, 4), (3, 4), (5, 4), (3, 2)] >>> ip.insertion(Integer(4)) The Tamari interval of size 5 induced by relations [(2, 3), (4, 5), (5, 3), (4, 3)] >>> ip.insertion(Integer(5)) The Tamari interval of size 5 induced by relations [(2, 3), (5, 4), (4, 3)] >>> ip = TamariIntervalPoset(Integer(0), []) >>> ip.insertion(Integer(1)) The Tamari interval of size 1 induced by relations [] >>> ip = TamariIntervalPoset(Integer(1), []) >>> ip.insertion(Integer(1)) The Tamari interval of size 2 induced by relations [(1, 2)] >>> ip.insertion(Integer(2)) The Tamari interval of size 2 induced by relations [(2, 1)] 
 - intersection(other)[source]¶
- Return the interval-poset formed by combining the relations from both - selfand- other. It corresponds to the intersection of the two corresponding intervals of the Tamari lattice.- INPUT: - other– an interval-poset of the same size as- self
 - EXAMPLES: - sage: ip1 = TamariIntervalPoset(4,[(1,2),(2,3)]) sage: ip2 = TamariIntervalPoset(4,[(4,3)]) sage: ip1.intersection(ip2) The Tamari interval of size 4 induced by relations [(1, 2), (2, 3), (4, 3)] sage: ip3 = TamariIntervalPoset(4,[(2,1)]) sage: ip1.intersection(ip3) Traceback (most recent call last): ... ValueError: this intersection is empty, it does not correspond to an interval-poset sage: ip4 = TamariIntervalPoset(3,[(2,3)]) sage: ip2.intersection(ip4) Traceback (most recent call last): ... ValueError: intersections are only possible on interval-posets of the same size - >>> from sage.all import * >>> ip1 = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3))]) >>> ip2 = TamariIntervalPoset(Integer(4),[(Integer(4),Integer(3))]) >>> ip1.intersection(ip2) The Tamari interval of size 4 induced by relations [(1, 2), (2, 3), (4, 3)] >>> ip3 = TamariIntervalPoset(Integer(4),[(Integer(2),Integer(1))]) >>> ip1.intersection(ip3) Traceback (most recent call last): ... ValueError: this intersection is empty, it does not correspond to an interval-poset >>> ip4 = TamariIntervalPoset(Integer(3),[(Integer(2),Integer(3))]) >>> ip2.intersection(ip4) Traceback (most recent call last): ... ValueError: intersections are only possible on interval-posets of the same size 
 - interval_cardinality()[source]¶
- Return the cardinality of the interval, i.e., the number of elements (binary trees or Dyck words) in the interval represented by - self.- Not to be confused with - size()which is the number of vertices.- See also - EXAMPLES: - sage: TamariIntervalPoset(4,[(2,4),(3,4),(2,1),(3,1)]).interval_cardinality() 4 sage: TamariIntervalPoset(4,[]).interval_cardinality() 14 sage: TamariIntervalPoset(4,[(1,2),(2,3),(3,4)]).interval_cardinality() 1 - >>> from sage.all import * >>> TamariIntervalPoset(Integer(4),[(Integer(2),Integer(4)),(Integer(3),Integer(4)),(Integer(2),Integer(1)),(Integer(3),Integer(1))]).interval_cardinality() 4 >>> TamariIntervalPoset(Integer(4),[]).interval_cardinality() 14 >>> TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3)),(Integer(3),Integer(4))]).interval_cardinality() 1 
 - is_connected()[source]¶
- Return whether - selfis a connected Tamari interval.- This means that the Hasse diagram is connected. - This condition is invariant under complementation. - See also - EXAMPLES: - sage: len([T for T in TamariIntervalPosets(3) if T.is_connected()]) 8 - >>> from sage.all import * >>> len([T for T in TamariIntervalPosets(Integer(3)) if T.is_connected()]) 8 
 - is_dexter()[source]¶
- Return whether - selfis a dexter Tamari interval.- This is defined by an exclusion pattern in the Hasse diagram. See the code for the exact description. - This condition is not invariant under complementation. - EXAMPLES: - sage: len([T for T in TamariIntervalPosets(3) if T.is_dexter()]) 12 - >>> from sage.all import * >>> len([T for T in TamariIntervalPosets(Integer(3)) if T.is_dexter()]) 12 
 - is_exceptional()[source]¶
- Return whether - selfis an exceptional Tamari interval.- This is defined by exclusion of a simple pattern in the Hasse diagram, namely there is no configuration - y <-- x --> zwith \(1 \leq y < x < z \leq n\).- This condition is invariant under complementation. - EXAMPLES: - sage: len([T for T in TamariIntervalPosets(3) ....: if T.is_exceptional()]) 12 - >>> from sage.all import * >>> len([T for T in TamariIntervalPosets(Integer(3)) ... if T.is_exceptional()]) 12 
 - is_final_interval()[source]¶
- Return if - selfcorresponds to a final interval of the Tamari lattice.- This means that its upper end is the largest element of the lattice. It consists of checking that - selfdoes not contain any increasing relations.- See also - EXAMPLES: - sage: ip = TamariIntervalPoset(4, [(4, 3), (3, 1), (2, 1)]) sage: ip.is_final_interval() True sage: ip.upper_dyck_word() # needs sage.combinat [1, 1, 1, 1, 0, 0, 0, 0] sage: ip = TamariIntervalPoset(4, [(4, 3), (3, 1), (2, 1), (2, 3)]) sage: ip.is_final_interval() False sage: ip.upper_dyck_word() # needs sage.combinat [1, 1, 0, 1, 1, 0, 0, 0] sage: all(dw.tamari_interval(DyckWord([1, 1, 1, 0, 0, 0])) # needs sage.combinat ....: .is_final_interval() ....: for dw in DyckWords(3)) True - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4), [(Integer(4), Integer(3)), (Integer(3), Integer(1)), (Integer(2), Integer(1))]) >>> ip.is_final_interval() True >>> ip.upper_dyck_word() # needs sage.combinat [1, 1, 1, 1, 0, 0, 0, 0] >>> ip = TamariIntervalPoset(Integer(4), [(Integer(4), Integer(3)), (Integer(3), Integer(1)), (Integer(2), Integer(1)), (Integer(2), Integer(3))]) >>> ip.is_final_interval() False >>> ip.upper_dyck_word() # needs sage.combinat [1, 1, 0, 1, 1, 0, 0, 0] >>> all(dw.tamari_interval(DyckWord([Integer(1), Integer(1), Integer(1), Integer(0), Integer(0), Integer(0)])) # needs sage.combinat ... .is_final_interval() ... for dw in DyckWords(Integer(3))) True 
 - is_indecomposable()[source]¶
- Return whether - selfis an indecomposable Tamari interval.- This is the terminology of [Cha2008]. - This means that the upper binary tree has an empty left subtree. - This condition is not invariant under complementation. - See also - EXAMPLES: - sage: len([T for T in TamariIntervalPosets(3) ....: if T.is_indecomposable()]) 8 - >>> from sage.all import * >>> len([T for T in TamariIntervalPosets(Integer(3)) ... if T.is_indecomposable()]) 8 
 - is_infinitely_modern()[source]¶
- Return whether - selfis an infinitely-modern Tamari interval.- This is defined by the exclusion of the configuration \(i \rightarrow i + 1\) and \(j + 1 \rightarrow j\) with \(i < j\). - This condition is invariant under complementation. - See also - EXAMPLES: - sage: len([T for T in TamariIntervalPosets(3) ....: if T.is_infinitely_modern()]) 12 - >>> from sage.all import * >>> len([T for T in TamariIntervalPosets(Integer(3)) ... if T.is_infinitely_modern()]) 12 - REFERENCES: 
 - is_initial_interval()[source]¶
- Return if - selfcorresponds to an initial interval of the Tamari lattice.- This means that its lower end is the smallest element of the lattice. It consists of checking that - selfdoes not contain any decreasing relations.- See also - EXAMPLES: - sage: ip = TamariIntervalPoset(4, [(1, 2), (2, 4), (3, 4)]) sage: ip.is_initial_interval() True sage: ip.lower_dyck_word() # needs sage.combinat [1, 0, 1, 0, 1, 0, 1, 0] sage: ip = TamariIntervalPoset(4, [(1, 2), (2, 4), (3, 4), (3, 2)]) sage: ip.is_initial_interval() False sage: ip.lower_dyck_word() # needs sage.combinat [1, 0, 1, 1, 0, 0, 1, 0] sage: all(DyckWord([1,0,1,0,1,0]).tamari_interval(dw) # needs sage.combinat ....: .is_initial_interval() ....: for dw in DyckWords(3)) True - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4), [(Integer(1), Integer(2)), (Integer(2), Integer(4)), (Integer(3), Integer(4))]) >>> ip.is_initial_interval() True >>> ip.lower_dyck_word() # needs sage.combinat [1, 0, 1, 0, 1, 0, 1, 0] >>> ip = TamariIntervalPoset(Integer(4), [(Integer(1), Integer(2)), (Integer(2), Integer(4)), (Integer(3), Integer(4)), (Integer(3), Integer(2))]) >>> ip.is_initial_interval() False >>> ip.lower_dyck_word() # needs sage.combinat [1, 0, 1, 1, 0, 0, 1, 0] >>> all(DyckWord([Integer(1),Integer(0),Integer(1),Integer(0),Integer(1),Integer(0)]).tamari_interval(dw) # needs sage.combinat ... .is_initial_interval() ... for dw in DyckWords(Integer(3))) True 
 - is_linear_extension(perm)[source]¶
- Return whether the permutation - permis a linear extension of- self.- INPUT: - perm– a permutation of the size of- self
 - EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(1,2),(2,3),(4,3)]) sage: ip.is_linear_extension([1,4,2,3]) True sage: ip.is_linear_extension(Permutation([1,4,2,3])) True sage: ip.is_linear_extension(Permutation([1,4,3,2])) False - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3)),(Integer(4),Integer(3))]) >>> ip.is_linear_extension([Integer(1),Integer(4),Integer(2),Integer(3)]) True >>> ip.is_linear_extension(Permutation([Integer(1),Integer(4),Integer(2),Integer(3)])) True >>> ip.is_linear_extension(Permutation([Integer(1),Integer(4),Integer(3),Integer(2)])) False 
 - is_modern()[source]¶
- Return whether - selfis a modern Tamari interval.- This is defined by exclusion of a simple pattern in the Hasse diagram, namely there is no configuration \(y \rightarrow x \leftarrow z\) with \(1 \leq y < x < z \leq n\). - This condition is invariant under complementation. - See also - EXAMPLES: - sage: len([T for T in TamariIntervalPosets(3) if T.is_modern()]) 12 - >>> from sage.all import * >>> len([T for T in TamariIntervalPosets(Integer(3)) if T.is_modern()]) 12 - REFERENCES: 
 - is_new()[source]¶
- Return whether - selfis a new Tamari interval.- Here ‘new’ means that the interval is not contained in any facet of the associahedron. This condition is invariant under complementation. - They have been considered in section 9 of [Cha2008]. - See also - EXAMPLES: - sage: TIP4 = TamariIntervalPosets(4) sage: len([u for u in TIP4 if u.is_new()]) 12 sage: TIP3 = TamariIntervalPosets(3) sage: len([u for u in TIP3 if u.is_new()]) 3 - >>> from sage.all import * >>> TIP4 = TamariIntervalPosets(Integer(4)) >>> len([u for u in TIP4 if u.is_new()]) 12 >>> TIP3 = TamariIntervalPosets(Integer(3)) >>> len([u for u in TIP3 if u.is_new()]) 3 
 - is_simple()[source]¶
- Return whether - selfis a simple Tamari interval.- Here ‘simple’ means that the interval contains a unique binary tree. - These intervals define the simple modules over the incidence algebras of the Tamari lattices. - See also - EXAMPLES: - sage: TIP4 = TamariIntervalPosets(4) sage: len([u for u in TIP4 if u.is_simple()]) 14 sage: TIP3 = TamariIntervalPosets(3) sage: len([u for u in TIP3 if u.is_simple()]) 5 - >>> from sage.all import * >>> TIP4 = TamariIntervalPosets(Integer(4)) >>> len([u for u in TIP4 if u.is_simple()]) 14 >>> TIP3 = TamariIntervalPosets(Integer(3)) >>> len([u for u in TIP3 if u.is_simple()]) 5 
 - is_synchronized()[source]¶
- Return whether - selfis a synchronized Tamari interval.- This means that the upper and lower binary trees have the same canopee. This condition is invariant under complementation. - This has been considered in [FPR2015]. The numbers of synchronized intervals are given by the sequence OEIS sequence A000139. - EXAMPLES: - sage: len([T for T in TamariIntervalPosets(3) ....: if T.is_synchronized()]) 6 - >>> from sage.all import * >>> len([T for T in TamariIntervalPosets(Integer(3)) ... if T.is_synchronized()]) 6 
 - latex_options()[source]¶
- Return the latex options for use in the - _latex_function as a dictionary.- The default values are set using the options. - tikz_scale– (default: 1) scale for use with the tikz package
- line_width– (default: 1) value representing the line width (additionally scaled by- tikz_scale)
- color_decreasing– (default:- 'red') the color for decreasing relations
- color_increasing– (default:- 'blue') the color for increasing relations
- hspace– (default: 1) the difference between horizontal coordinates of adjacent vertices
- vspace– (default: 1) the difference between vertical coordinates of adjacent vertices
 - EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(2,4),(3,4),(2,1),(3,1)]) sage: ip.latex_options()['color_decreasing'] 'red' sage: ip.latex_options()['hspace'] 1 - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(2),Integer(4)),(Integer(3),Integer(4)),(Integer(2),Integer(1)),(Integer(3),Integer(1))]) >>> ip.latex_options()['color_decreasing'] 'red' >>> ip.latex_options()['hspace'] 1 
 - le(e1, e2)[source]¶
- Return whether - e1precedes or equals- e2in- self.- EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(1,2),(2,3)]) sage: ip.le(1,2) True sage: ip.le(1,3) True sage: ip.le(2,3) True sage: ip.le(3,4) False sage: ip.le(1,1) True - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3))]) >>> ip.le(Integer(1),Integer(2)) True >>> ip.le(Integer(1),Integer(3)) True >>> ip.le(Integer(2),Integer(3)) True >>> ip.le(Integer(3),Integer(4)) False >>> ip.le(Integer(1),Integer(1)) True 
 - left_branch_involution()[source]¶
- Return the image of - selfby the left-branch involution.- OUTPUT: an interval-poset - See also - EXAMPLES: - sage: tip = TamariIntervalPoset(8, [(1,2), (2,4), (3,4), (6,7), (3,2), (5,4), (6,4), (8,7)]) sage: t = tip.left_branch_involution(); t The Tamari interval of size 8 induced by relations [(1, 6), (2, 6), (3, 5), (4, 5), (5, 6), (6, 8), (7, 8), (7, 6), (4, 3), (3, 1), (2, 1)] sage: t.left_branch_involution() == tip True - >>> from sage.all import * >>> tip = TamariIntervalPoset(Integer(8), [(Integer(1),Integer(2)), (Integer(2),Integer(4)), (Integer(3),Integer(4)), (Integer(6),Integer(7)), (Integer(3),Integer(2)), (Integer(5),Integer(4)), (Integer(6),Integer(4)), (Integer(8),Integer(7))]) >>> t = tip.left_branch_involution(); t The Tamari interval of size 8 induced by relations [(1, 6), (2, 6), (3, 5), (4, 5), (5, 6), (6, 8), (7, 8), (7, 6), (4, 3), (3, 1), (2, 1)] >>> t.left_branch_involution() == tip True - REFERENCES: 
 - linear_extensions()[source]¶
- Return an iterator on the permutations which are linear extensions of - self.- They form an interval of the right weak order (also called the right permutohedron order – see - permutohedron_lequal()for a definition).- EXAMPLES: - sage: ip = TamariIntervalPoset(3, [(1,2),(3,2)]) sage: list(ip.linear_extensions()) # needs sage.modules sage.rings.finite_rings [[3, 1, 2], [1, 3, 2]] sage: ip = TamariIntervalPoset(4, [(1,2),(2,3),(4,3)]) sage: list(ip.linear_extensions()) # needs sage.modules sage.rings.finite_rings [[4, 1, 2, 3], [1, 2, 4, 3], [1, 4, 2, 3]] - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(3), [(Integer(1),Integer(2)),(Integer(3),Integer(2))]) >>> list(ip.linear_extensions()) # needs sage.modules sage.rings.finite_rings [[3, 1, 2], [1, 3, 2]] >>> ip = TamariIntervalPoset(Integer(4), [(Integer(1),Integer(2)),(Integer(2),Integer(3)),(Integer(4),Integer(3))]) >>> list(ip.linear_extensions()) # needs sage.modules sage.rings.finite_rings [[4, 1, 2, 3], [1, 2, 4, 3], [1, 4, 2, 3]] 
 - lower_binary_tree()[source]¶
- Return the lowest binary tree in the interval of the Tamari lattice represented by - self.- This is a binary tree. It is the shape of the unique binary search tree whose left-branch ordered forest (i.e., the result of applying - to_ordered_tree_left_branch()and cutting off the root) is the final forest of- self.- See also - EXAMPLES: - sage: ip = TamariIntervalPoset(6, [(3,2),(4,3),(5,2),(6,5),(1,2),(4,5)]); ip The Tamari interval of size 6 induced by relations [(1, 2), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] sage: ip.lower_binary_tree() [[., .], [[., [., .]], [., .]]] sage: ff = TamariIntervalPosets.final_forest(ip.lower_binary_tree()) sage: ff == ip.final_forest() True sage: ip == TamariIntervalPosets.from_binary_trees(ip.lower_binary_tree(), ....: ip.upper_binary_tree()) True - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(6), [(Integer(3),Integer(2)),(Integer(4),Integer(3)),(Integer(5),Integer(2)),(Integer(6),Integer(5)),(Integer(1),Integer(2)),(Integer(4),Integer(5))]); ip The Tamari interval of size 6 induced by relations [(1, 2), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] >>> ip.lower_binary_tree() [[., .], [[., [., .]], [., .]]] >>> ff = TamariIntervalPosets.final_forest(ip.lower_binary_tree()) >>> ff == ip.final_forest() True >>> ip == TamariIntervalPosets.from_binary_trees(ip.lower_binary_tree(), ... ip.upper_binary_tree()) True 
 - lower_contained_intervals()[source]¶
- If - selfrepresents the interval \([t_1, t_2]\) of the Tamari lattice, return an iterator on all intervals \([t_1,t]\) with \(t \leq t_2\) for the Tamari lattice.- In terms of interval-posets, it corresponds to adding all possible relations of the form \(n\) precedes \(m\) with \(n<m\). - EXAMPLES: - sage: ip = TamariIntervalPoset(4, [(2,4),(3,4),(2,1),(3,1)]) sage: list(ip.lower_contained_intervals()) [The Tamari interval of size 4 induced by relations [(2, 4), (3, 4), (3, 1), (2, 1)], The Tamari interval of size 4 induced by relations [(1, 4), (2, 4), (3, 4), (3, 1), (2, 1)], The Tamari interval of size 4 induced by relations [(2, 3), (3, 4), (3, 1), (2, 1)], The Tamari interval of size 4 induced by relations [(1, 4), (2, 3), (3, 4), (3, 1), (2, 1)]] sage: ip = TamariIntervalPoset(4,[]) sage: len(list(ip.lower_contained_intervals())) 14 - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4), [(Integer(2),Integer(4)),(Integer(3),Integer(4)),(Integer(2),Integer(1)),(Integer(3),Integer(1))]) >>> list(ip.lower_contained_intervals()) [The Tamari interval of size 4 induced by relations [(2, 4), (3, 4), (3, 1), (2, 1)], The Tamari interval of size 4 induced by relations [(1, 4), (2, 4), (3, 4), (3, 1), (2, 1)], The Tamari interval of size 4 induced by relations [(2, 3), (3, 4), (3, 1), (2, 1)], The Tamari interval of size 4 induced by relations [(1, 4), (2, 3), (3, 4), (3, 1), (2, 1)]] >>> ip = TamariIntervalPoset(Integer(4),[]) >>> len(list(ip.lower_contained_intervals())) 14 
 - lower_contains_interval(other)[source]¶
- Return whether the interval represented by - otheris contained in- selfas an interval of the Tamari lattice and if they share the same lower bound.- As interval-posets, it means that - othercontains the relations of- selfplus some extra increasing relations.- INPUT: - other– an interval-poset
 - EXAMPLES: - sage: ip1 = TamariIntervalPoset(4,[(1,2),(2,3),(4,3)]) sage: ip2 = TamariIntervalPoset(4,[(4,3)]) sage: ip2.lower_contains_interval(ip1) True sage: ip2.contains_interval(ip1) and ip2.lower_binary_tree() == ip1.lower_binary_tree() True sage: ip3 = TamariIntervalPoset(4,[(4,3),(2,1)]) sage: ip2.contains_interval(ip3) True sage: ip2.lower_binary_tree() == ip3.lower_binary_tree() False sage: ip2.lower_contains_interval(ip3) False - >>> from sage.all import * >>> ip1 = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3)),(Integer(4),Integer(3))]) >>> ip2 = TamariIntervalPoset(Integer(4),[(Integer(4),Integer(3))]) >>> ip2.lower_contains_interval(ip1) True >>> ip2.contains_interval(ip1) and ip2.lower_binary_tree() == ip1.lower_binary_tree() True >>> ip3 = TamariIntervalPoset(Integer(4),[(Integer(4),Integer(3)),(Integer(2),Integer(1))]) >>> ip2.contains_interval(ip3) True >>> ip2.lower_binary_tree() == ip3.lower_binary_tree() False >>> ip2.lower_contains_interval(ip3) False 
 - lower_dyck_word()[source]¶
- Return the lowest Dyck word in the interval of the Tamari lattice represented by - self.- See also - EXAMPLES: - sage: # needs sage.combinat sage: ip = TamariIntervalPoset(6, [(3,2),(4,3),(5,2),(6,5),(1,2),(4,5)]); ip The Tamari interval of size 6 induced by relations [(1, 2), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] sage: ip.lower_dyck_word() [1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0] sage: ldw_ff = TamariIntervalPosets.final_forest(ip.lower_dyck_word()) sage: ldw_ff == ip.final_forest() True sage: ip == TamariIntervalPosets.from_dyck_words(ip.lower_dyck_word(), ....: ip.upper_dyck_word()) True - >>> from sage.all import * >>> # needs sage.combinat >>> ip = TamariIntervalPoset(Integer(6), [(Integer(3),Integer(2)),(Integer(4),Integer(3)),(Integer(5),Integer(2)),(Integer(6),Integer(5)),(Integer(1),Integer(2)),(Integer(4),Integer(5))]); ip The Tamari interval of size 6 induced by relations [(1, 2), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] >>> ip.lower_dyck_word() [1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0] >>> ldw_ff = TamariIntervalPosets.final_forest(ip.lower_dyck_word()) >>> ldw_ff == ip.final_forest() True >>> ip == TamariIntervalPosets.from_dyck_words(ip.lower_dyck_word(), ... ip.upper_dyck_word()) True 
 - lt(e1, e2)[source]¶
- Return whether - e1strictly precedes- e2in- self.- EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(1,2),(2,3)]) sage: ip.lt(1,2) True sage: ip.lt(1,3) True sage: ip.lt(2,3) True sage: ip.lt(3,4) False sage: ip.lt(1,1) False - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3))]) >>> ip.lt(Integer(1),Integer(2)) True >>> ip.lt(Integer(1),Integer(3)) True >>> ip.lt(Integer(2),Integer(3)) True >>> ip.lt(Integer(3),Integer(4)) False >>> ip.lt(Integer(1),Integer(1)) False 
 - max_linear_extension()[source]¶
- Return the maximal permutation for the right weak order which is a linear extension of - self.- This is also the maximal permutation in the sylvester class of - self.upper_binary_tree()and is a 132-avoiding permutation.- The right weak order is also known as the right permutohedron order. See - permutohedron_lequal()for its definition.- EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(1,2),(2,3),(4,3)]) sage: ip.max_linear_extension() [4, 1, 2, 3] sage: ip = TamariIntervalPoset(6,[(3,2),(4,3),(5,2),(6,5),(1,2),(4,5)]); ip The Tamari interval of size 6 induced by relations [(1, 2), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] sage: ip.max_linear_extension() [6, 4, 5, 3, 1, 2] sage: ip = TamariIntervalPoset(0,[]); ip The Tamari interval of size 0 induced by relations [] sage: ip.max_linear_extension() [] sage: ip = TamariIntervalPoset(5, [(1, 4), (2, 4), (3, 4), (5, 4)]); ip The Tamari interval of size 5 induced by relations [(1, 4), (2, 4), (3, 4), (5, 4)] sage: ip.max_linear_extension() [5, 3, 2, 1, 4] - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3)),(Integer(4),Integer(3))]) >>> ip.max_linear_extension() [4, 1, 2, 3] >>> ip = TamariIntervalPoset(Integer(6),[(Integer(3),Integer(2)),(Integer(4),Integer(3)),(Integer(5),Integer(2)),(Integer(6),Integer(5)),(Integer(1),Integer(2)),(Integer(4),Integer(5))]); ip The Tamari interval of size 6 induced by relations [(1, 2), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] >>> ip.max_linear_extension() [6, 4, 5, 3, 1, 2] >>> ip = TamariIntervalPoset(Integer(0),[]); ip The Tamari interval of size 0 induced by relations [] >>> ip.max_linear_extension() [] >>> ip = TamariIntervalPoset(Integer(5), [(Integer(1), Integer(4)), (Integer(2), Integer(4)), (Integer(3), Integer(4)), (Integer(5), Integer(4))]); ip The Tamari interval of size 5 induced by relations [(1, 4), (2, 4), (3, 4), (5, 4)] >>> ip.max_linear_extension() [5, 3, 2, 1, 4] 
 - maximal_chain_binary_trees()[source]¶
- Return an iterator on the binary trees forming a longest chain of - self(regarding- selfas an interval of the Tamari lattice).- EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(2,4),(3,4),(2,1),(3,1)]) sage: list(ip.maximal_chain_binary_trees()) [[[., [[., .], .]], .], [., [[[., .], .], .]], [., [[., [., .]], .]]] sage: ip = TamariIntervalPoset(4,[]) sage: list(ip.maximal_chain_binary_trees()) [[[[[., .], .], .], .], [[[., [., .]], .], .], [[., [[., .], .]], .], [., [[[., .], .], .]], [., [[., [., .]], .]], [., [., [[., .], .]]], [., [., [., [., .]]]]] - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(2),Integer(4)),(Integer(3),Integer(4)),(Integer(2),Integer(1)),(Integer(3),Integer(1))]) >>> list(ip.maximal_chain_binary_trees()) [[[., [[., .], .]], .], [., [[[., .], .], .]], [., [[., [., .]], .]]] >>> ip = TamariIntervalPoset(Integer(4),[]) >>> list(ip.maximal_chain_binary_trees()) [[[[[., .], .], .], .], [[[., [., .]], .], .], [[., [[., .], .]], .], [., [[[., .], .], .]], [., [[., [., .]], .]], [., [., [[., .], .]]], [., [., [., [., .]]]]] 
 - maximal_chain_dyck_words()[source]¶
- Return an iterator on the Dyck words forming a longest chain of - self(regarding- selfas an interval of the Tamari lattice).- EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(2,4),(3,4),(2,1),(3,1)]) sage: list(ip.maximal_chain_dyck_words()) # needs sage.combinat [[1, 1, 0, 1, 0, 0, 1, 0], [1, 1, 0, 1, 0, 1, 0, 0], [1, 1, 1, 0, 0, 1, 0, 0]] sage: ip = TamariIntervalPoset(4,[]) sage: list(ip.maximal_chain_dyck_words()) # needs sage.combinat [[1, 0, 1, 0, 1, 0, 1, 0], [1, 1, 0, 0, 1, 0, 1, 0], [1, 1, 0, 1, 0, 0, 1, 0], [1, 1, 0, 1, 0, 1, 0, 0], [1, 1, 1, 0, 0, 1, 0, 0], [1, 1, 1, 0, 1, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0]] - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(2),Integer(4)),(Integer(3),Integer(4)),(Integer(2),Integer(1)),(Integer(3),Integer(1))]) >>> list(ip.maximal_chain_dyck_words()) # needs sage.combinat [[1, 1, 0, 1, 0, 0, 1, 0], [1, 1, 0, 1, 0, 1, 0, 0], [1, 1, 1, 0, 0, 1, 0, 0]] >>> ip = TamariIntervalPoset(Integer(4),[]) >>> list(ip.maximal_chain_dyck_words()) # needs sage.combinat [[1, 0, 1, 0, 1, 0, 1, 0], [1, 1, 0, 0, 1, 0, 1, 0], [1, 1, 0, 1, 0, 0, 1, 0], [1, 1, 0, 1, 0, 1, 0, 0], [1, 1, 1, 0, 0, 1, 0, 0], [1, 1, 1, 0, 1, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0]] 
 - maximal_chain_tamari_intervals()[source]¶
- Return an iterator on the upper contained intervals of one longest chain of the Tamari interval represented by - self.- If - selfrepresents the interval \([T_1,T_2]\) of the Tamari lattice, this returns intervals \([T',T_2]\) with \(T'\) following one longest chain between \(T_1\) and \(T_2\).- To obtain a longest chain, we use the Tamari inversions of - self. The elements of the chain are obtained by adding one by one the relations \((b,a)\) from each Tamari inversion \((a,b)\) to- self, where the Tamari inversions are taken in lexicographic order.- EXAMPLES: - sage: ip = TamariIntervalPoset(4, [(2,4),(3,4),(2,1),(3,1)]) sage: list(ip.maximal_chain_tamari_intervals()) [The Tamari interval of size 4 induced by relations [(2, 4), (3, 4), (3, 1), (2, 1)], The Tamari interval of size 4 induced by relations [(2, 4), (3, 4), (4, 1), (3, 1), (2, 1)], The Tamari interval of size 4 induced by relations [(2, 4), (3, 4), (4, 1), (3, 2), (2, 1)]] sage: ip = TamariIntervalPoset(4, []) sage: list(ip.maximal_chain_tamari_intervals()) [The Tamari interval of size 4 induced by relations [], The Tamari interval of size 4 induced by relations [(2, 1)], The Tamari interval of size 4 induced by relations [(3, 1), (2, 1)], The Tamari interval of size 4 induced by relations [(4, 1), (3, 1), (2, 1)], The Tamari interval of size 4 induced by relations [(4, 1), (3, 2), (2, 1)], The Tamari interval of size 4 induced by relations [(4, 2), (3, 2), (2, 1)], The Tamari interval of size 4 induced by relations [(4, 3), (3, 2), (2, 1)]] - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4), [(Integer(2),Integer(4)),(Integer(3),Integer(4)),(Integer(2),Integer(1)),(Integer(3),Integer(1))]) >>> list(ip.maximal_chain_tamari_intervals()) [The Tamari interval of size 4 induced by relations [(2, 4), (3, 4), (3, 1), (2, 1)], The Tamari interval of size 4 induced by relations [(2, 4), (3, 4), (4, 1), (3, 1), (2, 1)], The Tamari interval of size 4 induced by relations [(2, 4), (3, 4), (4, 1), (3, 2), (2, 1)]] >>> ip = TamariIntervalPoset(Integer(4), []) >>> list(ip.maximal_chain_tamari_intervals()) [The Tamari interval of size 4 induced by relations [], The Tamari interval of size 4 induced by relations [(2, 1)], The Tamari interval of size 4 induced by relations [(3, 1), (2, 1)], The Tamari interval of size 4 induced by relations [(4, 1), (3, 1), (2, 1)], The Tamari interval of size 4 induced by relations [(4, 1), (3, 2), (2, 1)], The Tamari interval of size 4 induced by relations [(4, 2), (3, 2), (2, 1)], The Tamari interval of size 4 induced by relations [(4, 3), (3, 2), (2, 1)]] 
 - min_linear_extension()[source]¶
- Return the minimal permutation for the right weak order which is a linear extension of - self.- This is also the minimal permutation in the sylvester class of - self.lower_binary_tree()and is a 312-avoiding permutation.- The right weak order is also known as the right permutohedron order. See - permutohedron_lequal()for its definition.- EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(1,2),(2,3),(4,3)]) sage: ip.min_linear_extension() [1, 2, 4, 3] sage: ip = TamariIntervalPoset(6,[(3,2),(4,3),(5,2),(6,5),(1,2),(4,5)]) sage: ip.min_linear_extension() [1, 4, 3, 6, 5, 2] sage: ip = TamariIntervalPoset(0,[]) sage: ip.min_linear_extension() [] sage: ip = TamariIntervalPoset(5, [(1, 4), (2, 4), (3, 4), (5, 4)]); ip The Tamari interval of size 5 induced by relations [(1, 4), (2, 4), (3, 4), (5, 4)] sage: ip.min_linear_extension() [1, 2, 3, 5, 4] - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3)),(Integer(4),Integer(3))]) >>> ip.min_linear_extension() [1, 2, 4, 3] >>> ip = TamariIntervalPoset(Integer(6),[(Integer(3),Integer(2)),(Integer(4),Integer(3)),(Integer(5),Integer(2)),(Integer(6),Integer(5)),(Integer(1),Integer(2)),(Integer(4),Integer(5))]) >>> ip.min_linear_extension() [1, 4, 3, 6, 5, 2] >>> ip = TamariIntervalPoset(Integer(0),[]) >>> ip.min_linear_extension() [] >>> ip = TamariIntervalPoset(Integer(5), [(Integer(1), Integer(4)), (Integer(2), Integer(4)), (Integer(3), Integer(4)), (Integer(5), Integer(4))]); ip The Tamari interval of size 5 induced by relations [(1, 4), (2, 4), (3, 4), (5, 4)] >>> ip.min_linear_extension() [1, 2, 3, 5, 4] 
 - new_decomposition()[source]¶
- Return the decomposition of the interval-poset into new interval-posets. - Every interval-poset has a unique decomposition as a planar tree of new interval-posets, as explained in [Cha2008]. This function computes the terms of this decomposition, but not the planar tree. - For the number of terms, you can use instead the method - number_of_new_components().- OUTPUT: list of new interval-posets - See also - EXAMPLES: - sage: ex = TamariIntervalPosets(4)[11] sage: ex.number_of_new_components() 3 sage: ex.new_decomposition() # needs sage.combinat [The Tamari interval of size 1 induced by relations [], The Tamari interval of size 2 induced by relations [], The Tamari interval of size 1 induced by relations []] - >>> from sage.all import * >>> ex = TamariIntervalPosets(Integer(4))[Integer(11)] >>> ex.number_of_new_components() 3 >>> ex.new_decomposition() # needs sage.combinat [The Tamari interval of size 1 induced by relations [], The Tamari interval of size 2 induced by relations [], The Tamari interval of size 1 induced by relations []] 
 - number_of_new_components()[source]¶
- Return the number of terms in the decomposition in new interval-posets. - Every interval-poset has a unique decomposition as a planar tree of new interval-posets, as explained in [Cha2008]. This function just computes the number of terms, not the planar tree nor the terms themselves. - See also - EXAMPLES: - sage: TIP4 = TamariIntervalPosets(4) sage: nb = [u.number_of_new_components() for u in TIP4] sage: [nb.count(i) for i in range(1, 5)] [12, 21, 21, 14] - >>> from sage.all import * >>> TIP4 = TamariIntervalPosets(Integer(4)) >>> nb = [u.number_of_new_components() for u in TIP4] >>> [nb.count(i) for i in range(Integer(1), Integer(5))] [12, 21, 21, 14] 
 - number_of_tamari_inversions()[source]¶
- Return the number of Tamari inversions of - self.- This is also the length the longest chain of the Tamari interval represented by - self.- EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(2,4),(3,4),(2,1),(3,1)]) sage: ip.number_of_tamari_inversions() 2 sage: ip = TamariIntervalPoset(4,[]) sage: ip.number_of_tamari_inversions() 6 sage: ip = TamariIntervalPoset(3,[]) sage: ip.number_of_tamari_inversions() 3 - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(2),Integer(4)),(Integer(3),Integer(4)),(Integer(2),Integer(1)),(Integer(3),Integer(1))]) >>> ip.number_of_tamari_inversions() 2 >>> ip = TamariIntervalPoset(Integer(4),[]) >>> ip.number_of_tamari_inversions() 6 >>> ip = TamariIntervalPoset(Integer(3),[]) >>> ip.number_of_tamari_inversions() 3 
 - plot(**kwds)[source]¶
- Return a picture. - The picture represents the Hasse diagram, where the covers are colored in blue if they are increasing and in red if they are decreasing. - This uses the same coordinates as the latex view. - EXAMPLES: - sage: ti = TamariIntervalPosets(4)[2] sage: ti.plot() # needs sage.plot Graphics object consisting of 6 graphics primitives - >>> from sage.all import * >>> ti = TamariIntervalPosets(Integer(4))[Integer(2)] >>> ti.plot() # needs sage.plot Graphics object consisting of 6 graphics primitives 
 - poset()[source]¶
- Return - selfas a labelled poset.- An interval-poset is indeed constructed from a labelled poset which is stored internally. This method allows to access the poset and all the associated methods. - EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(1,2),(3,2),(2,4),(3,4)]) sage: pos = ip.poset(); pos Finite poset containing 4 elements sage: pos.maximal_chains() [[3, 2, 4], [1, 2, 4]] sage: pos.maximal_elements() [4] sage: pos.is_lattice() False - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(3),Integer(2)),(Integer(2),Integer(4)),(Integer(3),Integer(4))]) >>> pos = ip.poset(); pos Finite poset containing 4 elements >>> pos.maximal_chains() [[3, 2, 4], [1, 2, 4]] >>> pos.maximal_elements() [4] >>> pos.is_lattice() False 
 - rise_contact_involution()[source]¶
- Return the image of - selfby the rise-contact involution.- OUTPUT: an interval-poset - This is defined by conjugating the complement involution by the left-branch involution. - See also - EXAMPLES: - sage: tip = TamariIntervalPoset(8, [(1,2), (2,4), (3,4), (6,7), ....: (3,2), (5,4), (6,4), (8,7)]) sage: t = tip.rise_contact_involution(); t The Tamari interval of size 8 induced by relations [(2, 8), (3, 8), (4, 5), (5, 7), (6, 7), (7, 8), (8, 1), (7, 2), (6, 2), (5, 3), (4, 3), (3, 2), (2, 1)] sage: t.rise_contact_involution() == tip True sage: (tip.lower_dyck_word().number_of_touch_points() # needs sage.combinat ....: == t.upper_dyck_word().number_of_initial_rises()) True sage: tip.number_of_tamari_inversions() == t.number_of_tamari_inversions() True - >>> from sage.all import * >>> tip = TamariIntervalPoset(Integer(8), [(Integer(1),Integer(2)), (Integer(2),Integer(4)), (Integer(3),Integer(4)), (Integer(6),Integer(7)), ... (Integer(3),Integer(2)), (Integer(5),Integer(4)), (Integer(6),Integer(4)), (Integer(8),Integer(7))]) >>> t = tip.rise_contact_involution(); t The Tamari interval of size 8 induced by relations [(2, 8), (3, 8), (4, 5), (5, 7), (6, 7), (7, 8), (8, 1), (7, 2), (6, 2), (5, 3), (4, 3), (3, 2), (2, 1)] >>> t.rise_contact_involution() == tip True >>> (tip.lower_dyck_word().number_of_touch_points() # needs sage.combinat ... == t.upper_dyck_word().number_of_initial_rises()) True >>> tip.number_of_tamari_inversions() == t.number_of_tamari_inversions() True - REFERENCES: 
 - set_latex_options(D)[source]¶
- Set the latex options for use in the - _latex_function.- The default values are set in the - __init__function.- tikz_scale– (default: 1) scale for use with the tikz package
- line_width– (default: 1 *- tikz_scale) value representing the line width
- color_decreasing– (default: red) the color for decreasing relations
- color_increasing– (default: blue) the color for increasing relations
- hspace– (default: 1) the difference between horizontal coordinates of adjacent vertices
- vspace– (default: 1) the difference between vertical coordinates of adjacent vertices
 - INPUT: - D– dictionary with a list of latex parameters to change
 - EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(2,4),(3,4),(2,1),(3,1)]) sage: ip.latex_options()["color_decreasing"] 'red' sage: ip.set_latex_options({"color_decreasing":'green'}) sage: ip.latex_options()["color_decreasing"] 'green' sage: ip.set_latex_options({"color_increasing":'black'}) sage: ip.latex_options()["color_increasing"] 'black' - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(2),Integer(4)),(Integer(3),Integer(4)),(Integer(2),Integer(1)),(Integer(3),Integer(1))]) >>> ip.latex_options()["color_decreasing"] 'red' >>> ip.set_latex_options({"color_decreasing":'green'}) >>> ip.latex_options()["color_decreasing"] 'green' >>> ip.set_latex_options({"color_increasing":'black'}) >>> ip.latex_options()["color_increasing"] 'black' - To change the default options for all interval-posets, use the parent’s latex options: - sage: ip = TamariIntervalPoset(4,[(2,4),(3,4),(2,1),(3,1)]) sage: ip2 = TamariIntervalPoset(4,[(1,2),(2,3)]) sage: ip.latex_options()["color_decreasing"] 'red' sage: ip2.latex_options()["color_decreasing"] 'red' sage: TamariIntervalPosets.options(latex_color_decreasing='green') sage: ip.latex_options()["color_decreasing"] 'green' sage: ip2.latex_options()["color_decreasing"] 'green' - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(2),Integer(4)),(Integer(3),Integer(4)),(Integer(2),Integer(1)),(Integer(3),Integer(1))]) >>> ip2 = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3))]) >>> ip.latex_options()["color_decreasing"] 'red' >>> ip2.latex_options()["color_decreasing"] 'red' >>> TamariIntervalPosets.options(latex_color_decreasing='green') >>> ip.latex_options()["color_decreasing"] 'green' >>> ip2.latex_options()["color_decreasing"] 'green' - Next we set a local latex option and show the global option does not override it: - sage: ip.set_latex_options({"color_decreasing": 'black'}) sage: ip.latex_options()["color_decreasing"] 'black' sage: TamariIntervalPosets.options(latex_color_decreasing='blue') sage: ip.latex_options()["color_decreasing"] 'black' sage: ip2.latex_options()["color_decreasing"] 'blue' sage: TamariIntervalPosets.options._reset() - >>> from sage.all import * >>> ip.set_latex_options({"color_decreasing": 'black'}) >>> ip.latex_options()["color_decreasing"] 'black' >>> TamariIntervalPosets.options(latex_color_decreasing='blue') >>> ip.latex_options()["color_decreasing"] 'black' >>> ip2.latex_options()["color_decreasing"] 'blue' >>> TamariIntervalPosets.options._reset() 
 - size()[source]¶
- Return the size (number of vertices) of the interval-poset. - EXAMPLES: - sage: TamariIntervalPoset(3,[(2,1),(3,1)]).size() 3 - >>> from sage.all import * >>> TamariIntervalPoset(Integer(3),[(Integer(2),Integer(1)),(Integer(3),Integer(1))]).size() 3 
 - sub_poset(start, end)[source]¶
- Return the renormalized subposet of - selfconsisting solely of integers from- start(inclusive) to- end(not inclusive).- “Renormalized” means that these integers are relabelled \(1,2,\ldots,k\) in the obvious way (i.e., by subtracting - start - 1).- INPUT: - start– integer; the starting vertex (inclusive)
- end– integer; the ending vertex (not inclusive)
 - EXAMPLES: - sage: ip = TamariIntervalPoset(6, [(3,2),(4,3),(5,2),(6,5),(1,2),(3,5),(4,5)]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] sage: ip.subposet(1,3) The Tamari interval of size 2 induced by relations [(1, 2)] sage: ip.subposet(1,4) The Tamari interval of size 3 induced by relations [(1, 2), (3, 2)] sage: ip.subposet(1,5) The Tamari interval of size 4 induced by relations [(1, 2), (4, 3), (3, 2)] sage: ip.subposet(1,7) == ip True sage: ip.subposet(1,1) The Tamari interval of size 0 induced by relations [] - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(6), [(Integer(3),Integer(2)),(Integer(4),Integer(3)),(Integer(5),Integer(2)),(Integer(6),Integer(5)),(Integer(1),Integer(2)),(Integer(3),Integer(5)),(Integer(4),Integer(5))]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] >>> ip.subposet(Integer(1),Integer(3)) The Tamari interval of size 2 induced by relations [(1, 2)] >>> ip.subposet(Integer(1),Integer(4)) The Tamari interval of size 3 induced by relations [(1, 2), (3, 2)] >>> ip.subposet(Integer(1),Integer(5)) The Tamari interval of size 4 induced by relations [(1, 2), (4, 3), (3, 2)] >>> ip.subposet(Integer(1),Integer(7)) == ip True >>> ip.subposet(Integer(1),Integer(1)) The Tamari interval of size 0 induced by relations [] 
 - subposet(start, end)[source]¶
- Return the renormalized subposet of - selfconsisting solely of integers from- start(inclusive) to- end(not inclusive).- “Renormalized” means that these integers are relabelled \(1,2,\ldots,k\) in the obvious way (i.e., by subtracting - start - 1).- INPUT: - start– integer; the starting vertex (inclusive)
- end– integer; the ending vertex (not inclusive)
 - EXAMPLES: - sage: ip = TamariIntervalPoset(6, [(3,2),(4,3),(5,2),(6,5),(1,2),(3,5),(4,5)]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] sage: ip.subposet(1,3) The Tamari interval of size 2 induced by relations [(1, 2)] sage: ip.subposet(1,4) The Tamari interval of size 3 induced by relations [(1, 2), (3, 2)] sage: ip.subposet(1,5) The Tamari interval of size 4 induced by relations [(1, 2), (4, 3), (3, 2)] sage: ip.subposet(1,7) == ip True sage: ip.subposet(1,1) The Tamari interval of size 0 induced by relations [] - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(6), [(Integer(3),Integer(2)),(Integer(4),Integer(3)),(Integer(5),Integer(2)),(Integer(6),Integer(5)),(Integer(1),Integer(2)),(Integer(3),Integer(5)),(Integer(4),Integer(5))]); ip The Tamari interval of size 6 induced by relations [(1, 2), (3, 5), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] >>> ip.subposet(Integer(1),Integer(3)) The Tamari interval of size 2 induced by relations [(1, 2)] >>> ip.subposet(Integer(1),Integer(4)) The Tamari interval of size 3 induced by relations [(1, 2), (3, 2)] >>> ip.subposet(Integer(1),Integer(5)) The Tamari interval of size 4 induced by relations [(1, 2), (4, 3), (3, 2)] >>> ip.subposet(Integer(1),Integer(7)) == ip True >>> ip.subposet(Integer(1),Integer(1)) The Tamari interval of size 0 induced by relations [] 
 - tamari_inversions()[source]¶
- Return the Tamari inversions of - self.- A Tamari inversion is a pair of vertices \((a,b)\) with \(a < b\) such that: - the decreasing parent of \(b\) is strictly smaller than \(a\) (or does not exist), and 
- the increasing parent of \(a\) is strictly bigger than \(b\) (or does not exist). 
 - “Smaller” and “bigger” refer to the numerical values of the elements, not to the poset order. - This method returns the list of all Tamari inversions in lexicographic order. - The number of Tamari inversions is the length of the longest chain of the Tamari interval represented by - self.- Indeed, when an interval consists of just one binary tree, it has no inversion. One can also prove that if a Tamari interval \(I' = [T_1', T_2']\) is a proper subset of a Tamari interval \(I = [T_1, T_2]\), then the inversion number of \(I'\) is strictly lower than the inversion number of \(I\). And finally, by adding the relation \((b,a)\) to the interval-poset where \((a,b)\) is the first inversion of \(I\) in lexicographic order, one reduces the inversion number by exactly \(1\). - EXAMPLES: - sage: ip = TamariIntervalPoset(3,[]) sage: ip.tamari_inversions() [(1, 2), (1, 3), (2, 3)] sage: ip = TamariIntervalPoset(3,[(2,1)]) sage: ip.tamari_inversions() [(1, 3), (2, 3)] sage: ip = TamariIntervalPoset(3,[(1,2)]) sage: ip.tamari_inversions() [(2, 3)] sage: ip = TamariIntervalPoset(3,[(1,2),(3,2)]) sage: ip.tamari_inversions() [] sage: ip = TamariIntervalPoset(4,[(2,4),(3,4),(2,1),(3,1)]) sage: ip.tamari_inversions() [(1, 4), (2, 3)] sage: ip = TamariIntervalPoset(4,[]) sage: ip.tamari_inversions() [(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)] sage: all(not TamariIntervalPosets.from_binary_trees(bt,bt) # needs sage.combinat ....: .tamari_inversions() ....: for bt in BinaryTrees(3)) True sage: all(not TamariIntervalPosets.from_binary_trees(bt,bt) # needs sage.combinat ....: .tamari_inversions() ....: for bt in BinaryTrees(4)) True - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(3),[]) >>> ip.tamari_inversions() [(1, 2), (1, 3), (2, 3)] >>> ip = TamariIntervalPoset(Integer(3),[(Integer(2),Integer(1))]) >>> ip.tamari_inversions() [(1, 3), (2, 3)] >>> ip = TamariIntervalPoset(Integer(3),[(Integer(1),Integer(2))]) >>> ip.tamari_inversions() [(2, 3)] >>> ip = TamariIntervalPoset(Integer(3),[(Integer(1),Integer(2)),(Integer(3),Integer(2))]) >>> ip.tamari_inversions() [] >>> ip = TamariIntervalPoset(Integer(4),[(Integer(2),Integer(4)),(Integer(3),Integer(4)),(Integer(2),Integer(1)),(Integer(3),Integer(1))]) >>> ip.tamari_inversions() [(1, 4), (2, 3)] >>> ip = TamariIntervalPoset(Integer(4),[]) >>> ip.tamari_inversions() [(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)] >>> all(not TamariIntervalPosets.from_binary_trees(bt,bt) # needs sage.combinat ... .tamari_inversions() ... for bt in BinaryTrees(Integer(3))) True >>> all(not TamariIntervalPosets.from_binary_trees(bt,bt) # needs sage.combinat ... .tamari_inversions() ... for bt in BinaryTrees(Integer(4))) True 
 - tamari_inversions_iter()[source]¶
- Iterate over the Tamari inversions of - self, in lexicographic order.- See - tamari_inversions()for the definition of the terms involved.- EXAMPLES: - sage: T = TamariIntervalPoset(5, [[1,2],[3,4],[3,2],[5,2],[4,2]]) sage: list(T.tamari_inversions_iter()) [(4, 5)] sage: T = TamariIntervalPoset(8, [(2, 7), (3, 7), (4, 7), (5, 7), (6, 7), ....: (8, 7), (6, 4), (5, 4), (4, 3), (3, 2)]) sage: list(T.tamari_inversions_iter()) [(1, 2), (1, 7), (5, 6)] sage: T = TamariIntervalPoset(1, []) sage: list(T.tamari_inversions_iter()) [] sage: T = TamariIntervalPoset(0, []) sage: list(T.tamari_inversions_iter()) [] - >>> from sage.all import * >>> T = TamariIntervalPoset(Integer(5), [[Integer(1),Integer(2)],[Integer(3),Integer(4)],[Integer(3),Integer(2)],[Integer(5),Integer(2)],[Integer(4),Integer(2)]]) >>> list(T.tamari_inversions_iter()) [(4, 5)] >>> T = TamariIntervalPoset(Integer(8), [(Integer(2), Integer(7)), (Integer(3), Integer(7)), (Integer(4), Integer(7)), (Integer(5), Integer(7)), (Integer(6), Integer(7)), ... (Integer(8), Integer(7)), (Integer(6), Integer(4)), (Integer(5), Integer(4)), (Integer(4), Integer(3)), (Integer(3), Integer(2))]) >>> list(T.tamari_inversions_iter()) [(1, 2), (1, 7), (5, 6)] >>> T = TamariIntervalPoset(Integer(1), []) >>> list(T.tamari_inversions_iter()) [] >>> T = TamariIntervalPoset(Integer(0), []) >>> list(T.tamari_inversions_iter()) [] 
 - upper_binary_tree()[source]¶
- Return the highest binary tree in the interval of the Tamari lattice represented by - self.- This is a binary tree. It is the shape of the unique binary search tree whose right-branch ordered forest (i.e., the result of applying - to_ordered_tree_right_branch()and cutting off the root) is the initial forest of- self.- See also - EXAMPLES: - sage: ip = TamariIntervalPoset(6,[(3,2),(4,3),(5,2),(6,5),(1,2),(4,5)]); ip The Tamari interval of size 6 induced by relations [(1, 2), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] sage: ip.upper_binary_tree() [[., .], [., [[., .], [., .]]]] sage: TamariIntervalPosets.initial_forest(ip.upper_binary_tree()) == ip.initial_forest() True sage: ip == TamariIntervalPosets.from_binary_trees(ip.lower_binary_tree(),ip.upper_binary_tree()) True - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(6),[(Integer(3),Integer(2)),(Integer(4),Integer(3)),(Integer(5),Integer(2)),(Integer(6),Integer(5)),(Integer(1),Integer(2)),(Integer(4),Integer(5))]); ip The Tamari interval of size 6 induced by relations [(1, 2), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] >>> ip.upper_binary_tree() [[., .], [., [[., .], [., .]]]] >>> TamariIntervalPosets.initial_forest(ip.upper_binary_tree()) == ip.initial_forest() True >>> ip == TamariIntervalPosets.from_binary_trees(ip.lower_binary_tree(),ip.upper_binary_tree()) True 
 - upper_contains_interval(other)[source]¶
- Return whether the interval represented by - otheris contained in- selfas an interval of the Tamari lattice and if they share the same upper bound.- As interval-posets, it means that - othercontains the relations of- selfplus some extra decreasing relations.- INPUT: - other– an interval-poset
 - EXAMPLES: - sage: ip1 = TamariIntervalPoset(4,[(1,2),(2,3),(4,3)]) sage: ip2 = TamariIntervalPoset(4,[(1,2),(2,3)]) sage: ip2.upper_contains_interval(ip1) True sage: ip2.contains_interval(ip1) and ip2.upper_binary_tree() == ip1.upper_binary_tree() True sage: ip3 = TamariIntervalPoset(4,[(1,2),(2,3),(3,4)]) sage: ip2.upper_contains_interval(ip3) False sage: ip2.contains_interval(ip3) True sage: ip2.upper_binary_tree() == ip3.upper_binary_tree() False - >>> from sage.all import * >>> ip1 = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3)),(Integer(4),Integer(3))]) >>> ip2 = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3))]) >>> ip2.upper_contains_interval(ip1) True >>> ip2.contains_interval(ip1) and ip2.upper_binary_tree() == ip1.upper_binary_tree() True >>> ip3 = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3)),(Integer(3),Integer(4))]) >>> ip2.upper_contains_interval(ip3) False >>> ip2.contains_interval(ip3) True >>> ip2.upper_binary_tree() == ip3.upper_binary_tree() False 
 - upper_dyck_word()[source]¶
- Return the highest Dyck word in the interval of the Tamari lattice represented by - self.- See also - EXAMPLES: - sage: # needs sage.combinat sage: ip = TamariIntervalPoset(6,[(3,2),(4,3),(5,2),(6,5),(1,2),(4,5)]); ip The Tamari interval of size 6 induced by relations [(1, 2), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] sage: ip.upper_dyck_word() [1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0] sage: udw_if = TamariIntervalPosets.initial_forest(ip.upper_dyck_word()) sage: udw_if == ip.initial_forest() True sage: ip == TamariIntervalPosets.from_dyck_words(ip.lower_dyck_word(), ....: ip.upper_dyck_word()) True - >>> from sage.all import * >>> # needs sage.combinat >>> ip = TamariIntervalPoset(Integer(6),[(Integer(3),Integer(2)),(Integer(4),Integer(3)),(Integer(5),Integer(2)),(Integer(6),Integer(5)),(Integer(1),Integer(2)),(Integer(4),Integer(5))]); ip The Tamari interval of size 6 induced by relations [(1, 2), (4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] >>> ip.upper_dyck_word() [1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0] >>> udw_if = TamariIntervalPosets.initial_forest(ip.upper_dyck_word()) >>> udw_if == ip.initial_forest() True >>> ip == TamariIntervalPosets.from_dyck_words(ip.lower_dyck_word(), ... ip.upper_dyck_word()) True 
 
- class sage.combinat.interval_posets.TamariIntervalPosets[source]¶
- Bases: - UniqueRepresentation,- Parent- Factory for interval-posets. - INPUT: - size– integer (optional)
 - OUTPUT: - the set of all interval-posets (of the given - sizeif specified)
 - EXAMPLES: - sage: TamariIntervalPosets() Interval-posets sage: TamariIntervalPosets(2) Interval-posets of size 2 - >>> from sage.all import * >>> TamariIntervalPosets() Interval-posets >>> TamariIntervalPosets(Integer(2)) Interval-posets of size 2 - Note - This is a factory class whose constructor returns instances of subclasses. - static check_poset(poset)[source]¶
- Check if the given poset - posetis a interval-poset, that is, if it satisfies the following properties:- Its labels are exactly \(1, \ldots, n\) where \(n\) is its size. 
- If \(a < c\) (as numbers) and \(a\) precedes \(c\), then \(b\) precedes \(c\) for all \(b\) such that \(a < b < c\). 
- If \(a < c\) (as numbers) and \(c\) precedes \(a\), then \(b\) precedes \(a\) for all \(b\) such that \(a < b < c\). 
 - INPUT: - poset– a finite labeled poset
 - EXAMPLES: - sage: p = Poset(([1,2,3],[(1,2),(3,2)])) sage: TamariIntervalPosets.check_poset(p) True sage: p = Poset(([2,3],[(3,2)])) sage: TamariIntervalPosets.check_poset(p) False sage: p = Poset(([1,2,3],[(3,1)])) sage: TamariIntervalPosets.check_poset(p) False sage: p = Poset(([1,2,3],[(1,3)])) sage: TamariIntervalPosets.check_poset(p) False - >>> from sage.all import * >>> p = Poset(([Integer(1),Integer(2),Integer(3)],[(Integer(1),Integer(2)),(Integer(3),Integer(2))])) >>> TamariIntervalPosets.check_poset(p) True >>> p = Poset(([Integer(2),Integer(3)],[(Integer(3),Integer(2))])) >>> TamariIntervalPosets.check_poset(p) False >>> p = Poset(([Integer(1),Integer(2),Integer(3)],[(Integer(3),Integer(1))])) >>> TamariIntervalPosets.check_poset(p) False >>> p = Poset(([Integer(1),Integer(2),Integer(3)],[(Integer(1),Integer(3))])) >>> TamariIntervalPosets.check_poset(p) False 
 - static final_forest(element)[source]¶
- Return the final forest of a binary tree, an interval-poset or a Dyck word. - A final forest is an interval-poset corresponding to a final interval of the Tamari lattice, i.e., containing only decreasing relations. - It can be constructed from a binary tree by its binary search tree labeling with the rule: \(b\) precedes \(a\) in the final forest iff \(b\) is in the right subtree of \(a\) in the binary search tree. - INPUT: - element– a binary tree, a Dyck word or an interval-poset
 - EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(1,2),(2,3),(4,3)]) sage: TamariIntervalPosets.final_forest(ip) The Tamari interval of size 4 induced by relations [(4, 3)] - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3)),(Integer(4),Integer(3))]) >>> TamariIntervalPosets.final_forest(ip) The Tamari interval of size 4 induced by relations [(4, 3)] - From binary trees: - sage: bt = BinaryTree(); bt . sage: TamariIntervalPosets.final_forest(bt) The Tamari interval of size 0 induced by relations [] sage: bt = BinaryTree([]); bt [., .] sage: TamariIntervalPosets.final_forest(bt) The Tamari interval of size 1 induced by relations [] sage: bt = BinaryTree([[],None]); bt [[., .], .] sage: TamariIntervalPosets.final_forest(bt) The Tamari interval of size 2 induced by relations [] sage: bt = BinaryTree([None,[]]); bt [., [., .]] sage: TamariIntervalPosets.final_forest(bt) The Tamari interval of size 2 induced by relations [(2, 1)] sage: bt = BinaryTree([[],[]]); bt [[., .], [., .]] sage: TamariIntervalPosets.final_forest(bt) The Tamari interval of size 3 induced by relations [(3, 2)] sage: bt = BinaryTree([[None,[[],None]],[]]); bt [[., [[., .], .]], [., .]] sage: TamariIntervalPosets.final_forest(bt) The Tamari interval of size 5 induced by relations [(5, 4), (3, 1), (2, 1)] - >>> from sage.all import * >>> bt = BinaryTree(); bt . >>> TamariIntervalPosets.final_forest(bt) The Tamari interval of size 0 induced by relations [] >>> bt = BinaryTree([]); bt [., .] >>> TamariIntervalPosets.final_forest(bt) The Tamari interval of size 1 induced by relations [] >>> bt = BinaryTree([[],None]); bt [[., .], .] >>> TamariIntervalPosets.final_forest(bt) The Tamari interval of size 2 induced by relations [] >>> bt = BinaryTree([None,[]]); bt [., [., .]] >>> TamariIntervalPosets.final_forest(bt) The Tamari interval of size 2 induced by relations [(2, 1)] >>> bt = BinaryTree([[],[]]); bt [[., .], [., .]] >>> TamariIntervalPosets.final_forest(bt) The Tamari interval of size 3 induced by relations [(3, 2)] >>> bt = BinaryTree([[None,[[],None]],[]]); bt [[., [[., .], .]], [., .]] >>> TamariIntervalPosets.final_forest(bt) The Tamari interval of size 5 induced by relations [(5, 4), (3, 1), (2, 1)] - From Dyck words: - sage: # needs sage.combinat sage: dw = DyckWord([1,0]) sage: TamariIntervalPosets.final_forest(dw) The Tamari interval of size 1 induced by relations [] sage: dw = DyckWord([1,1,0,1,0,0,1,1,0,0]) sage: TamariIntervalPosets.final_forest(dw) The Tamari interval of size 5 induced by relations [(5, 4), (3, 1), (2, 1)] - >>> from sage.all import * >>> # needs sage.combinat >>> dw = DyckWord([Integer(1),Integer(0)]) >>> TamariIntervalPosets.final_forest(dw) The Tamari interval of size 1 induced by relations [] >>> dw = DyckWord([Integer(1),Integer(1),Integer(0),Integer(1),Integer(0),Integer(0),Integer(1),Integer(1),Integer(0),Integer(0)]) >>> TamariIntervalPosets.final_forest(dw) The Tamari interval of size 5 induced by relations [(5, 4), (3, 1), (2, 1)] 
 - static from_binary_trees(tree1, tree2)[source]¶
- Return the interval-poset corresponding to the interval [ - tree1,- tree2] of the Tamari lattice.- Raise an exception if - tree1is not \(\leq\)- tree2in the Tamari lattice.- INPUT: - tree1– a binary tree
- tree2– a binary tree greater or equal than- tree1for the Tamari lattice
 - EXAMPLES: - sage: tree1 = BinaryTree([[],None]) sage: tree2 = BinaryTree([None,[]]) sage: TamariIntervalPosets.from_binary_trees(tree1,tree2) The Tamari interval of size 2 induced by relations [] sage: TamariIntervalPosets.from_binary_trees(tree1,tree1) The Tamari interval of size 2 induced by relations [(1, 2)] sage: TamariIntervalPosets.from_binary_trees(tree2,tree2) The Tamari interval of size 2 induced by relations [(2, 1)] sage: tree1 = BinaryTree([[],[[None,[]],[]]]) sage: tree2 = BinaryTree([None,[None,[None,[[],[]]]]]) sage: TamariIntervalPosets.from_binary_trees(tree1,tree2) The Tamari interval of size 6 induced by relations [(4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] sage: tree3 = BinaryTree([None,[None,[[],[None,[]]]]]) sage: TamariIntervalPosets.from_binary_trees(tree1,tree3) Traceback (most recent call last): ... ValueError: the two binary trees are not comparable on the Tamari lattice sage: TamariIntervalPosets.from_binary_trees(tree1,BinaryTree()) Traceback (most recent call last): ... ValueError: the two binary trees are not comparable on the Tamari lattice - >>> from sage.all import * >>> tree1 = BinaryTree([[],None]) >>> tree2 = BinaryTree([None,[]]) >>> TamariIntervalPosets.from_binary_trees(tree1,tree2) The Tamari interval of size 2 induced by relations [] >>> TamariIntervalPosets.from_binary_trees(tree1,tree1) The Tamari interval of size 2 induced by relations [(1, 2)] >>> TamariIntervalPosets.from_binary_trees(tree2,tree2) The Tamari interval of size 2 induced by relations [(2, 1)] >>> tree1 = BinaryTree([[],[[None,[]],[]]]) >>> tree2 = BinaryTree([None,[None,[None,[[],[]]]]]) >>> TamariIntervalPosets.from_binary_trees(tree1,tree2) The Tamari interval of size 6 induced by relations [(4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] >>> tree3 = BinaryTree([None,[None,[[],[None,[]]]]]) >>> TamariIntervalPosets.from_binary_trees(tree1,tree3) Traceback (most recent call last): ... ValueError: the two binary trees are not comparable on the Tamari lattice >>> TamariIntervalPosets.from_binary_trees(tree1,BinaryTree()) Traceback (most recent call last): ... ValueError: the two binary trees are not comparable on the Tamari lattice 
 - static from_dyck_words(dw1, dw2)[source]¶
- Return the interval-poset corresponding to the interval [ - dw1,- dw2] of the Tamari lattice.- Raise an exception if the two Dyck words - dw1and- dw2do not satisfy- dw1\(\leq\)- dw2in the Tamari lattice.- INPUT: - dw1– a Dyck word
- dw2– a Dyck word greater or equal than- dw1for the Tamari lattice
 - EXAMPLES: - sage: # needs sage.combinat sage: dw1 = DyckWord([1,0,1,0]) sage: dw2 = DyckWord([1,1,0,0]) sage: TamariIntervalPosets.from_dyck_words(dw1, dw2) The Tamari interval of size 2 induced by relations [] sage: TamariIntervalPosets.from_dyck_words(dw1,dw1) The Tamari interval of size 2 induced by relations [(1, 2)] sage: TamariIntervalPosets.from_dyck_words(dw2,dw2) The Tamari interval of size 2 induced by relations [(2, 1)] sage: # needs sage.combinat sage: dw1 = DyckWord([1,0,1,1,1,0,0,1,1,0,0,0]) sage: dw2 = DyckWord([1,1,1,1,0,1,1,0,0,0,0,0]) sage: TamariIntervalPosets.from_dyck_words(dw1,dw2) The Tamari interval of size 6 induced by relations [(4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] sage: dw3 = DyckWord([1,1,1,0,1,1,1,0,0,0,0,0]) sage: TamariIntervalPosets.from_dyck_words(dw1,dw3) Traceback (most recent call last): ... ValueError: the two Dyck words are not comparable on the Tamari lattice sage: TamariIntervalPosets.from_dyck_words(dw1,DyckWord([1,0])) Traceback (most recent call last): ... ValueError: the two Dyck words are not comparable on the Tamari lattice - >>> from sage.all import * >>> # needs sage.combinat >>> dw1 = DyckWord([Integer(1),Integer(0),Integer(1),Integer(0)]) >>> dw2 = DyckWord([Integer(1),Integer(1),Integer(0),Integer(0)]) >>> TamariIntervalPosets.from_dyck_words(dw1, dw2) The Tamari interval of size 2 induced by relations [] >>> TamariIntervalPosets.from_dyck_words(dw1,dw1) The Tamari interval of size 2 induced by relations [(1, 2)] >>> TamariIntervalPosets.from_dyck_words(dw2,dw2) The Tamari interval of size 2 induced by relations [(2, 1)] >>> # needs sage.combinat >>> dw1 = DyckWord([Integer(1),Integer(0),Integer(1),Integer(1),Integer(1),Integer(0),Integer(0),Integer(1),Integer(1),Integer(0),Integer(0),Integer(0)]) >>> dw2 = DyckWord([Integer(1),Integer(1),Integer(1),Integer(1),Integer(0),Integer(1),Integer(1),Integer(0),Integer(0),Integer(0),Integer(0),Integer(0)]) >>> TamariIntervalPosets.from_dyck_words(dw1,dw2) The Tamari interval of size 6 induced by relations [(4, 5), (6, 5), (5, 2), (4, 3), (3, 2)] >>> dw3 = DyckWord([Integer(1),Integer(1),Integer(1),Integer(0),Integer(1),Integer(1),Integer(1),Integer(0),Integer(0),Integer(0),Integer(0),Integer(0)]) >>> TamariIntervalPosets.from_dyck_words(dw1,dw3) Traceback (most recent call last): ... ValueError: the two Dyck words are not comparable on the Tamari lattice >>> TamariIntervalPosets.from_dyck_words(dw1,DyckWord([Integer(1),Integer(0)])) Traceback (most recent call last): ... ValueError: the two Dyck words are not comparable on the Tamari lattice 
 - static from_grafting_tree(tree)[source]¶
- Return an interval-poset from a grafting tree. - For the inverse method, see - TamariIntervalPoset.grafting_tree().- EXAMPLES: - sage: tip = TamariIntervalPoset(8, [(1,2), (2,4), (3,4), (6,7), (3,2), (5,4), (6,4), (8,7)]) sage: t = tip.grafting_tree() sage: TamariIntervalPosets.from_grafting_tree(t) == tip True - >>> from sage.all import * >>> tip = TamariIntervalPoset(Integer(8), [(Integer(1),Integer(2)), (Integer(2),Integer(4)), (Integer(3),Integer(4)), (Integer(6),Integer(7)), (Integer(3),Integer(2)), (Integer(5),Integer(4)), (Integer(6),Integer(4)), (Integer(8),Integer(7))]) >>> t = tip.grafting_tree() >>> TamariIntervalPosets.from_grafting_tree(t) == tip True - REFERENCES: 
 - static from_minimal_schnyder_wood(graph)[source]¶
- Return a Tamari interval built from a minimal Schnyder wood. - This is an implementation of Bernardi and Bonichon’s bijection [BeBo2009]. - INPUT: - graph– a minimal Schnyder wood, given as a graph with colored and oriented edges, without the three exterior unoriented edges
 - The three boundary vertices must be -1, -2 and -3. - One assumes moreover that the embedding around -1 is the list of neighbors of -1 and not just a cyclic permutation of that. - Beware that the embedding convention used here is the opposite of the one used by the plot method. - OUTPUT: a Tamari interval-poset - EXAMPLES: - A small example: - sage: TIP = TamariIntervalPosets sage: G = DiGraph([(0,-1,0),(0,-2,1),(0,-3,2)], format='list_of_edges') sage: G.set_embedding({-1:[0],-2:[0],-3:[0],0:[-1,-2,-3]}) sage: TIP.from_minimal_schnyder_wood(G) # needs sage.combinat The Tamari interval of size 1 induced by relations [] - >>> from sage.all import * >>> TIP = TamariIntervalPosets >>> G = DiGraph([(Integer(0),-Integer(1),Integer(0)),(Integer(0),-Integer(2),Integer(1)),(Integer(0),-Integer(3),Integer(2))], format='list_of_edges') >>> G.set_embedding({-Integer(1):[Integer(0)],-Integer(2):[Integer(0)],-Integer(3):[Integer(0)],Integer(0):[-Integer(1),-Integer(2),-Integer(3)]}) >>> TIP.from_minimal_schnyder_wood(G) # needs sage.combinat The Tamari interval of size 1 induced by relations [] - An example from page 14 of [BeBo2009]: - sage: c0 = [(0,-1),(1,0),(2,0),(4,3),(3,-1),(5,3)] sage: c1 = [(5,-2),(3,-2),(4,5),(1,3),(2,3),(0,3)] sage: c2 = [(0,-3),(1,-3),(3,-3),(4,-3),(5,-3),(2,1)] sage: ed = [(u,v,0) for u,v in c0] sage: ed += [(u,v,1) for u,v in c1] sage: ed += [(u,v,2) for u,v in c2] sage: G = DiGraph(ed, format='list_of_edges') sage: embed = {-1:[3,0],-2:[5,3],-3:[0,1,3,4,5]} sage: data_emb = [[3,2,1,-3,-1],[2,3,-3,0],[3,1,0]] sage: data_emb += [[-2,5,4,-3,1,2,0,-1],[5,-3,3],[-2,-3,4,3]] sage: for k in range(6): ....: embed[k] = data_emb[k] sage: G.set_embedding(embed) sage: TIP.from_minimal_schnyder_wood(G) # needs sage.combinat The Tamari interval of size 6 induced by relations [(1, 4), (2, 4), (3, 4), (5, 6), (6, 4), (5, 4), (3, 1), (2, 1)] - >>> from sage.all import * >>> c0 = [(Integer(0),-Integer(1)),(Integer(1),Integer(0)),(Integer(2),Integer(0)),(Integer(4),Integer(3)),(Integer(3),-Integer(1)),(Integer(5),Integer(3))] >>> c1 = [(Integer(5),-Integer(2)),(Integer(3),-Integer(2)),(Integer(4),Integer(5)),(Integer(1),Integer(3)),(Integer(2),Integer(3)),(Integer(0),Integer(3))] >>> c2 = [(Integer(0),-Integer(3)),(Integer(1),-Integer(3)),(Integer(3),-Integer(3)),(Integer(4),-Integer(3)),(Integer(5),-Integer(3)),(Integer(2),Integer(1))] >>> ed = [(u,v,Integer(0)) for u,v in c0] >>> ed += [(u,v,Integer(1)) for u,v in c1] >>> ed += [(u,v,Integer(2)) for u,v in c2] >>> G = DiGraph(ed, format='list_of_edges') >>> embed = {-Integer(1):[Integer(3),Integer(0)],-Integer(2):[Integer(5),Integer(3)],-Integer(3):[Integer(0),Integer(1),Integer(3),Integer(4),Integer(5)]} >>> data_emb = [[Integer(3),Integer(2),Integer(1),-Integer(3),-Integer(1)],[Integer(2),Integer(3),-Integer(3),Integer(0)],[Integer(3),Integer(1),Integer(0)]] >>> data_emb += [[-Integer(2),Integer(5),Integer(4),-Integer(3),Integer(1),Integer(2),Integer(0),-Integer(1)],[Integer(5),-Integer(3),Integer(3)],[-Integer(2),-Integer(3),Integer(4),Integer(3)]] >>> for k in range(Integer(6)): ... embed[k] = data_emb[k] >>> G.set_embedding(embed) >>> TIP.from_minimal_schnyder_wood(G) # needs sage.combinat The Tamari interval of size 6 induced by relations [(1, 4), (2, 4), (3, 4), (5, 6), (6, 4), (5, 4), (3, 1), (2, 1)] - An example from page 18 of [BeBo2009]: - sage: c0 = [(0,-1),(1,0),(2,-1),(3,2),(4,2),(5,-1)] sage: c1 = [(5,-2),(2,-2),(4,-2),(3,4),(1,2),(0,2)] sage: c2 = [(0,-3),(1,-3),(3,-3),(4,-3),(2,-3),(5,2)] sage: ed = [(u,v,0) for u,v in c0] sage: ed += [(u,v,1) for u,v in c1] sage: ed += [(u,v,2) for u,v in c2] sage: G = DiGraph(ed, format='list_of_edges') sage: embed = {-1:[5,2,0],-2:[4,2,5],-3:[0,1,2,3,4]} sage: data_emb = [[2,1,-3,-1],[2,-3,0],[3,-3,1,0,-1,5,-2,4]] sage: data_emb += [[4,-3,2],[-2,-3,3,2],[-2,2,-1]] sage: for k in range(6): ....: embed[k] = data_emb[k] sage: G.set_embedding(embed) sage: TIP.from_minimal_schnyder_wood(G) # needs sage.combinat The Tamari interval of size 6 induced by relations [(1, 3), (2, 3), (4, 5), (5, 3), (4, 3), (2, 1)] - >>> from sage.all import * >>> c0 = [(Integer(0),-Integer(1)),(Integer(1),Integer(0)),(Integer(2),-Integer(1)),(Integer(3),Integer(2)),(Integer(4),Integer(2)),(Integer(5),-Integer(1))] >>> c1 = [(Integer(5),-Integer(2)),(Integer(2),-Integer(2)),(Integer(4),-Integer(2)),(Integer(3),Integer(4)),(Integer(1),Integer(2)),(Integer(0),Integer(2))] >>> c2 = [(Integer(0),-Integer(3)),(Integer(1),-Integer(3)),(Integer(3),-Integer(3)),(Integer(4),-Integer(3)),(Integer(2),-Integer(3)),(Integer(5),Integer(2))] >>> ed = [(u,v,Integer(0)) for u,v in c0] >>> ed += [(u,v,Integer(1)) for u,v in c1] >>> ed += [(u,v,Integer(2)) for u,v in c2] >>> G = DiGraph(ed, format='list_of_edges') >>> embed = {-Integer(1):[Integer(5),Integer(2),Integer(0)],-Integer(2):[Integer(4),Integer(2),Integer(5)],-Integer(3):[Integer(0),Integer(1),Integer(2),Integer(3),Integer(4)]} >>> data_emb = [[Integer(2),Integer(1),-Integer(3),-Integer(1)],[Integer(2),-Integer(3),Integer(0)],[Integer(3),-Integer(3),Integer(1),Integer(0),-Integer(1),Integer(5),-Integer(2),Integer(4)]] >>> data_emb += [[Integer(4),-Integer(3),Integer(2)],[-Integer(2),-Integer(3),Integer(3),Integer(2)],[-Integer(2),Integer(2),-Integer(1)]] >>> for k in range(Integer(6)): ... embed[k] = data_emb[k] >>> G.set_embedding(embed) >>> TIP.from_minimal_schnyder_wood(G) # needs sage.combinat The Tamari interval of size 6 induced by relations [(1, 3), (2, 3), (4, 5), (5, 3), (4, 3), (2, 1)] - Another small example: - sage: c0 = [(0,-1),(2,-1),(1,0)] sage: c1 = [(2,-2),(1,-2),(0,2)] sage: c2 = [(0,-3),(1,-3),(2,1)] sage: ed = [(u,v,0) for u,v in c0] sage: ed += [(u,v,1) for u,v in c1] sage: ed += [(u,v,2) for u,v in c2] sage: G = DiGraph(ed, format='list_of_edges') sage: embed = {-1:[2,0],-2:[1,2],-3:[0,1]} sage: data_emb = [[2,1,-3,-1],[-3,0,2,-2],[-2,1,0,-1]] sage: for k in range(3): ....: embed[k] = data_emb[k] sage: G.set_embedding(embed) sage: TIP.from_minimal_schnyder_wood(G) # needs sage.combinat The Tamari interval of size 3 induced by relations [(2, 3), (2, 1)] - >>> from sage.all import * >>> c0 = [(Integer(0),-Integer(1)),(Integer(2),-Integer(1)),(Integer(1),Integer(0))] >>> c1 = [(Integer(2),-Integer(2)),(Integer(1),-Integer(2)),(Integer(0),Integer(2))] >>> c2 = [(Integer(0),-Integer(3)),(Integer(1),-Integer(3)),(Integer(2),Integer(1))] >>> ed = [(u,v,Integer(0)) for u,v in c0] >>> ed += [(u,v,Integer(1)) for u,v in c1] >>> ed += [(u,v,Integer(2)) for u,v in c2] >>> G = DiGraph(ed, format='list_of_edges') >>> embed = {-Integer(1):[Integer(2),Integer(0)],-Integer(2):[Integer(1),Integer(2)],-Integer(3):[Integer(0),Integer(1)]} >>> data_emb = [[Integer(2),Integer(1),-Integer(3),-Integer(1)],[-Integer(3),Integer(0),Integer(2),-Integer(2)],[-Integer(2),Integer(1),Integer(0),-Integer(1)]] >>> for k in range(Integer(3)): ... embed[k] = data_emb[k] >>> G.set_embedding(embed) >>> TIP.from_minimal_schnyder_wood(G) # needs sage.combinat The Tamari interval of size 3 induced by relations [(2, 3), (2, 1)] 
 - static initial_forest(element)[source]¶
- Return the initial forest of a binary tree, an interval-poset or a Dyck word. - An initial forest is an interval-poset corresponding to an initial interval of the Tamari lattice, i.e., containing only increasing relations. - It can be constructed from a binary tree by its binary search tree labeling with the rule: \(a\) precedes \(b\) in the initial forest iff \(a\) is in the left subtree of \(b\) in the binary search tree. - INPUT: - element– a binary tree, a Dyck word or an interval-poset
 - EXAMPLES: - sage: ip = TamariIntervalPoset(4,[(1,2),(2,3),(4,3)]) sage: TamariIntervalPosets.initial_forest(ip) The Tamari interval of size 4 induced by relations [(1, 2), (2, 3)] - >>> from sage.all import * >>> ip = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3)),(Integer(4),Integer(3))]) >>> TamariIntervalPosets.initial_forest(ip) The Tamari interval of size 4 induced by relations [(1, 2), (2, 3)] - with binary trees: - sage: bt = BinaryTree(); bt . sage: TamariIntervalPosets.initial_forest(bt) The Tamari interval of size 0 induced by relations [] sage: bt = BinaryTree([]); bt [., .] sage: TamariIntervalPosets.initial_forest(bt) The Tamari interval of size 1 induced by relations [] sage: bt = BinaryTree([[],None]); bt [[., .], .] sage: TamariIntervalPosets.initial_forest(bt) The Tamari interval of size 2 induced by relations [(1, 2)] sage: bt = BinaryTree([None,[]]); bt [., [., .]] sage: TamariIntervalPosets.initial_forest(bt) The Tamari interval of size 2 induced by relations [] sage: bt = BinaryTree([[],[]]); bt [[., .], [., .]] sage: TamariIntervalPosets.initial_forest(bt) The Tamari interval of size 3 induced by relations [(1, 2)] sage: bt = BinaryTree([[None,[[],None]],[]]); bt [[., [[., .], .]], [., .]] sage: TamariIntervalPosets.initial_forest(bt) The Tamari interval of size 5 induced by relations [(1, 4), (2, 3), (3, 4)] - >>> from sage.all import * >>> bt = BinaryTree(); bt . >>> TamariIntervalPosets.initial_forest(bt) The Tamari interval of size 0 induced by relations [] >>> bt = BinaryTree([]); bt [., .] >>> TamariIntervalPosets.initial_forest(bt) The Tamari interval of size 1 induced by relations [] >>> bt = BinaryTree([[],None]); bt [[., .], .] >>> TamariIntervalPosets.initial_forest(bt) The Tamari interval of size 2 induced by relations [(1, 2)] >>> bt = BinaryTree([None,[]]); bt [., [., .]] >>> TamariIntervalPosets.initial_forest(bt) The Tamari interval of size 2 induced by relations [] >>> bt = BinaryTree([[],[]]); bt [[., .], [., .]] >>> TamariIntervalPosets.initial_forest(bt) The Tamari interval of size 3 induced by relations [(1, 2)] >>> bt = BinaryTree([[None,[[],None]],[]]); bt [[., [[., .], .]], [., .]] >>> TamariIntervalPosets.initial_forest(bt) The Tamari interval of size 5 induced by relations [(1, 4), (2, 3), (3, 4)] - from Dyck words: - sage: # needs sage.combinat sage: dw = DyckWord([1,0]) sage: TamariIntervalPosets.initial_forest(dw) The Tamari interval of size 1 induced by relations [] sage: dw = DyckWord([1,1,0,1,0,0,1,1,0,0]) sage: TamariIntervalPosets.initial_forest(dw) The Tamari interval of size 5 induced by relations [(1, 4), (2, 3), (3, 4)] - >>> from sage.all import * >>> # needs sage.combinat >>> dw = DyckWord([Integer(1),Integer(0)]) >>> TamariIntervalPosets.initial_forest(dw) The Tamari interval of size 1 induced by relations [] >>> dw = DyckWord([Integer(1),Integer(1),Integer(0),Integer(1),Integer(0),Integer(0),Integer(1),Integer(1),Integer(0),Integer(0)]) >>> TamariIntervalPosets.initial_forest(dw) The Tamari interval of size 5 induced by relations [(1, 4), (2, 3), (3, 4)] 
 - le(el1, el2)[source]¶
- Poset structure on the set of interval-posets. - The comparison is first by size, then using the cubical coordinates. - See also - INPUT: - el1– an interval-poset
- el2– an interval-poset
 - EXAMPLES: - sage: ip1 = TamariIntervalPoset(4,[(1,2),(2,3),(4,3)]) sage: ip2 = TamariIntervalPoset(4,[(1,2),(2,3)]) sage: TamariIntervalPosets().le(ip1,ip2) False sage: TamariIntervalPosets().le(ip2,ip1) True - >>> from sage.all import * >>> ip1 = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3)),(Integer(4),Integer(3))]) >>> ip2 = TamariIntervalPoset(Integer(4),[(Integer(1),Integer(2)),(Integer(2),Integer(3))]) >>> TamariIntervalPosets().le(ip1,ip2) False >>> TamariIntervalPosets().le(ip2,ip1) True 
 - options = Current options for TamariIntervalPosets - latex_color_decreasing: red - latex_color_increasing: blue - latex_hspace: 1 - latex_line_width_scalar: 0.5 - latex_tikz_scale: 1 - latex_vspace: 1[source]¶
 - static recomposition_from_triple(left, right, r)[source]¶
- Recompose an interval-poset from a triple ( - left,- right,- r).- For the inverse method, see - TamariIntervalPoset.decomposition_to_triple().- INPUT: - left– an interval-poset
- right– an interval-poset
- r– the parameter of the decomposition, an integer
 - OUTPUT: an interval-poset - EXAMPLES: - sage: T1 = TamariIntervalPoset(3, [(1, 2), (3, 2)]) sage: T2 = TamariIntervalPoset(4, [(2, 3), (4, 3)]) sage: TamariIntervalPosets.recomposition_from_triple(T1, T2, 2) The Tamari interval of size 8 induced by relations [(1, 2), (2, 4), (3, 4), (6, 7), (8, 7), (6, 4), (5, 4), (3, 2)] - >>> from sage.all import * >>> T1 = TamariIntervalPoset(Integer(3), [(Integer(1), Integer(2)), (Integer(3), Integer(2))]) >>> T2 = TamariIntervalPoset(Integer(4), [(Integer(2), Integer(3)), (Integer(4), Integer(3))]) >>> TamariIntervalPosets.recomposition_from_triple(T1, T2, Integer(2)) The Tamari interval of size 8 induced by relations [(1, 2), (2, 4), (3, 4), (6, 7), (8, 7), (6, 4), (5, 4), (3, 2)] - REFERENCES: 
 
- class sage.combinat.interval_posets.TamariIntervalPosets_all[source]¶
- Bases: - DisjointUnionEnumeratedSets,- TamariIntervalPosets- The enumerated set of all Tamari interval-posets. - Element[source]¶
- alias of - TamariIntervalPoset
 - one()[source]¶
- Return the unit of the monoid. - This is the empty interval poset, of size 0. - EXAMPLES: - sage: TamariIntervalPosets().one() The Tamari interval of size 0 induced by relations [] - >>> from sage.all import * >>> TamariIntervalPosets().one() The Tamari interval of size 0 induced by relations [] 
 
- class sage.combinat.interval_posets.TamariIntervalPosets_size(size)[source]¶
- Bases: - TamariIntervalPosets- The enumerated set of interval-posets of a given size. - cardinality()[source]¶
- The cardinality of - self. That is, the number of interval-posets of size \(n\).- The formula was given in [Cha2008]: \[\frac{2(4n+1)!}{(n+1)!(3n+2)!} = \frac{2}{n(n+1)} \binom{4n+1}{n-1}.\]- EXAMPLES: - sage: [TamariIntervalPosets(i).cardinality() for i in range(6)] [1, 1, 3, 13, 68, 399] - >>> from sage.all import * >>> [TamariIntervalPosets(i).cardinality() for i in range(Integer(6))] [1, 1, 3, 13, 68, 399] 
 - random_element()[source]¶
- Return a random Tamari interval of fixed size. - This is obtained by first creating a random rooted planar triangulation, then computing its unique minimal Schnyder wood, then applying a bijection of Bernardi and Bonichon [BeBo2009]. - Because the random rooted planar triangulation is chosen uniformly at random, the Tamari interval is also chosen according to the uniform distribution. - EXAMPLES: - sage: # needs sage.combinat sage: T = TamariIntervalPosets(4).random_element() sage: T.parent() Interval-posets sage: u = T.lower_dyck_word(); u # random [1, 1, 0, 1, 0, 0, 1, 0] sage: v = T.lower_dyck_word(); v # random [1, 1, 0, 1, 0, 0, 1, 0] sage: len(u) 8 - >>> from sage.all import * >>> # needs sage.combinat >>> T = TamariIntervalPosets(Integer(4)).random_element() >>> T.parent() Interval-posets >>> u = T.lower_dyck_word(); u # random [1, 1, 0, 1, 0, 0, 1, 0] >>> v = T.lower_dyck_word(); v # random [1, 1, 0, 1, 0, 0, 1, 0] >>> len(u) 8