Skip to content

Commit 8627463

Browse files
committed
better handling of categories in posets
1 parent e0b23a9 commit 8627463

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/sage/combinat/posets/lattices.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,10 @@ def LatticePoset(data=None, *args, **options):
734734
error.x = P._vertex_to_element(error.x)
735735
error.y = P._vertex_to_element(error.y)
736736
raise
737-
return FiniteLatticePoset(P, category=FiniteLatticePosets(), facade=P._is_facade)
737+
cat = options.get('category', None)
738+
if cat is None:
739+
cat = FiniteLatticePosets()
740+
return FiniteLatticePoset(P, category=cat, facade=P._is_facade)
738741

739742

740743
class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):

src/sage/combinat/tamari_lattices.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,18 @@ def GeneralizedTamariLattice(a, b, m=1):
226226
def covers(p):
227227
return [swap(p, i, m) for i in range(len(p) - 1)
228228
if not p[i] and p[i + 1]]
229+
230+
# TODO check the exact best categories to use
231+
if m == 0: # generalized Dyck lattices
232+
cat = FiniteLatticePosets().Distributive()
233+
elif m == 1 and a == b + 1: # Tamari lattices
234+
cat = FiniteLatticePosets().Trim().CongruenceUniform()
235+
else:
236+
cat = FiniteLatticePosets()
237+
229238
return LatticePoset({p: covers(p)
230-
for p in paths_in_triangle(a, b, a, b)}, check=False)
239+
for p in paths_in_triangle(a, b, a, b)},
240+
check=False, category=cat)
231241

232242

233243
def TamariLattice(n, m=1):
@@ -264,12 +274,7 @@ def TamariLattice(n, m=1):
264274
265275
- [BMFPR2011]_
266276
"""
267-
T = GeneralizedTamariLattice(m * n + 1, n, m)
268-
if m == 1:
269-
T._refine_category_(FiniteLatticePosets().Trim().CongruenceUniform())
270-
else:
271-
T._refine_category_(FiniteLatticePosets().Semidistributive())
272-
return T
277+
return GeneralizedTamariLattice(m * n + 1, n, m)
273278

274279

275280
# a variation : the Dexter meet-semilattices

0 commit comments

Comments
 (0)