Skip to content

Commit efeb8f4

Browse files
author
Release Manager
committed
gh-39554: creating axioms for lattices as this would be a natural place to put some specific methods from #37601 ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. URL: #39554 Reported by: Frédéric Chapoton Reviewer(s): Frédéric Chapoton, Travis Scrimshaw
2 parents cb03043 + 70d4ef1 commit efeb8f4

File tree

8 files changed

+386
-41
lines changed

8 files changed

+386
-41
lines changed

src/sage/categories/category.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@
125125
_join_cache = WeakValueDictionary()
126126

127127

128-
HALL_OF_FAME = ['Coxeter', 'Hopf', 'Weyl', 'Lie', 'Hecke', 'Dedekind']
128+
HALL_OF_FAME = ['Coxeter', 'Hopf', 'Weyl', 'Lie',
129+
'Hecke', 'Dedekind', 'Stone']
129130

130131

131132
class Category(UniqueRepresentation, SageObject):

src/sage/categories/category_with_axiom.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,6 +1658,7 @@ class ``Sets.Finite``), or in a separate file (typically in a class
16581658

16591659
import importlib
16601660
import re
1661+
16611662
from sage.misc.cachefunc import cached_method, cached_function
16621663
from sage.misc.lazy_attribute import lazy_class_attribute
16631664
from sage.misc.lazy_import import LazyImport
@@ -1678,21 +1679,23 @@ class ``Sets.Finite``), or in a separate file (typically in a class
16781679
"Differentiable", "Smooth", "Analytic", "AlmostComplex",
16791680
"FinitelyGeneratedAsMagma",
16801681
"WellGenerated",
1681-
"Facade", "Finite", "Infinite","Enumerated",
1682+
"Facade", "Finite", "Infinite", "Enumerated",
16821683
"Complete",
16831684
"Nilpotent",
16841685
"FiniteDimensional", "FinitelyPresented", "Connected",
16851686
"FinitelyGeneratedAsLambdaBracketAlgebra",
16861687
"WithBasis",
16871688
"Irreducible",
16881689
"Supercommutative", "Supercocommutative",
1689-
"Commutative", "Cocommutative", "Associative", "Inverse", "Unital", "Division", "NoZeroDivisors", "Cellular",
1690+
"Commutative", "Cocommutative", "Associative",
1691+
"Inverse", "Unital", "Division", "NoZeroDivisors", "Cellular",
16901692
"AdditiveCommutative", "AdditiveAssociative", "AdditiveInverse", "AdditiveUnital",
1691-
"Distributive",
1693+
"Extremal", "Trim", "Semidistributive", "CongruenceUniform",
1694+
"Distributive", "Stone",
16921695
"Endset",
16931696
"Pointed",
1694-
"Stratified",
1695-
)
1697+
"Stratified"
1698+
)
16961699

16971700

16981701
def uncamelcase(s, separator=" "):

src/sage/categories/finite_lattice_posets.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
r"""
33
Finite lattice posets
44
"""
5-
#*****************************************************************************
5+
# ****************************************************************************
66
# Copyright (C) 2011 Nicolas M. Thiery <nthiery at users.sf.net>
77
#
88
# Distributed under the terms of the GNU General Public License (GPL)
9-
# http://www.gnu.org/licenses/
10-
#******************************************************************************
9+
# https://www.gnu.org/licenses/
10+
# *****************************************************************************
1111

1212
from sage.categories.category_with_axiom import CategoryWithAxiom
13+
from sage.misc.cachefunc import cached_method
1314

1415

1516
class FiniteLatticePosets(CategoryWithAxiom):
@@ -28,7 +29,8 @@ class FiniteLatticePosets(CategoryWithAxiom):
2829
2930
.. SEEALSO::
3031
31-
:class:`FinitePosets`, :class:`LatticePosets`, :class:`~sage.combinat.posets.lattices.FiniteLatticePoset`
32+
:class:`FinitePosets`, :class:`LatticePosets`,
33+
:class:`~sage.combinat.posets.lattices.FiniteLatticePoset`
3234
3335
TESTS::
3436
@@ -107,7 +109,7 @@ def meet_irreducibles(self):
107109

108110
def meet_irreducibles_poset(self):
109111
r"""
110-
Return the poset of join-irreducible elements of this finite lattice.
112+
Return the poset of join-irreducible elements of the lattice.
111113
112114
A *meet-irreducible element* of ``self`` is an element `x`
113115
that is not maximal and can not be written as the meet of two
@@ -116,7 +118,7 @@ def meet_irreducibles_poset(self):
116118
EXAMPLES::
117119
118120
sage: L = LatticePoset({0:[1,2,3],1:[4],2:[4],3:[4]}) # needs sage.graphs sage.modules
119-
sage: L.join_irreducibles_poset() # needs sage.graphs sage.modules
121+
sage: L.meet_irreducibles_poset() # needs sage.graphs sage.modules
120122
Finite poset containing 3 elements
121123
122124
.. SEEALSO::
@@ -166,10 +168,10 @@ def irreducibles_poset(self):
166168
return Poset({self[0]: []})
167169
return self.subposet(self.join_irreducibles()+self.meet_irreducibles())
168170

169-
##########################################################################
171+
######################################################################
170172
# Lattice morphisms
171173

172-
def is_lattice_morphism(self, f, codomain):
174+
def is_lattice_morphism(self, f, codomain) -> bool:
173175
r"""
174176
Return whether ``f`` is a morphism of posets from ``self``
175177
to ``codomain``.
@@ -234,9 +236,9 @@ def is_lattice_morphism(self, f, codomain):
234236
# ensure that this is a poset morphism. It actually may
235237
# be sufficient to check just joins (or just meets).
236238
from sage.combinat.subset import Subsets
237-
for x,y in Subsets(self,2):
238-
if f(self.join(x,y)) != codomain.join(f(x), f(y)):
239+
for x, y in Subsets(self, 2):
240+
if f(self.join(x, y)) != codomain.join(f(x), f(y)):
239241
return False
240-
if f(self.meet(x,y)) != codomain.meet(f(x), f(y)):
242+
if f(self.meet(x, y)) != codomain.meet(f(x), f(y)):
241243
return False
242244
return True

src/sage/categories/finite_posets.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,26 +1930,33 @@ def order_ideals_lattice(self, as_ideals=True, facade=None):
19301930
False
19311931
"""
19321932
from sage.combinat.posets.lattices import LatticePoset
1933+
from sage.categories.finite_lattice_posets import FiniteLatticePosets
19331934
if facade is None:
19341935
facade = self._is_facade
1936+
19351937
if as_ideals:
19361938
from sage.misc.call import attrcall
19371939
from sage.sets.set import Set
19381940
ideals = [Set(self.order_ideal(antichain))
19391941
for antichain in self.antichains()]
1940-
return LatticePoset((ideals, attrcall("issubset")),
1941-
facade=facade)
1942-
else:
1943-
from sage.misc.cachefunc import cached_function
1944-
antichains = [tuple(a) for a in self.antichains()]
1942+
T = LatticePoset((ideals, attrcall("issubset")),
1943+
facade=facade,
1944+
category=FiniteLatticePosets().Distributive())
1945+
return T
1946+
1947+
from sage.misc.cachefunc import cached_function
1948+
antichains = [tuple(a) for a in self.antichains()]
1949+
1950+
@cached_function
1951+
def is_above(a, xb):
1952+
return any(self.is_lequal(xa, xb) for xa in a)
19451953

1946-
@cached_function
1947-
def is_above(a, xb):
1948-
return any(self.is_lequal(xa, xb) for xa in a)
1954+
def compare(a, b):
1955+
return all(is_above(a, xb) for xb in b)
19491956

1950-
def compare(a, b):
1951-
return all(is_above(a, xb) for xb in b)
1952-
return LatticePoset((antichains, compare), facade=facade)
1957+
T = LatticePoset((antichains, compare), facade=facade,
1958+
category=FiniteLatticePosets().Distributive())
1959+
return T
19531960

19541961
@abstract_method(optional=True)
19551962
def antichains(self):

0 commit comments

Comments
 (0)