@@ -1593,7 +1593,7 @@ def is_trim(self, certificate=False) -> bool | tuple:
15931593 return (True , chain ) if certificate else True
15941594 return (False , None ) if certificate else False
15951595
1596- def is_left_modular (self , H = None , certificate = False ) -> bool | list :
1596+ def is_left_modular (self , H = None , certificate = False ) -> bool | tuple :
15971597 r"""
15981598 Return whether ``self`` is a left-modular lattice.
15991599
@@ -1602,27 +1602,30 @@ def is_left_modular(self, H=None, certificate=False) -> bool | list:
16021602 - ``H`` -- subset of elements; full ``self`` if no ``H`` is given
16031603
16041604 - ``certificate`` -- boolean (default: ``False``); whether to return
1605- a list of failures
1605+ a failure
16061606
16071607 OUTPUT:
16081608
1609- if ``certificate == True``, this outputs a list of tuples
1610- `(y, x, z)` which fail left-modularity.
1609+ if ``certificate == True``, this returns either ``(True, None)``
1610+ or ``(False, (y, x, z))`` where the tuple `(y, x, z)`
1611+ fails left-modularity.
16111612
1612- if ``certificate == False``, this outputs ``False``
1613- if any `x \in H` fails to be left-modular and ``True`` otherwise.
1613+ if ``certificate == False``, this returns ``False`` if any
1614+ `x \in H` fails to be left-modular and ``True`` otherwise.
16141615
16151616 ALGORITHM:
16161617
16171618 Given a lattice `L` and a subset of elements `H`,
16181619 an element `x \in H` is left-modular
16191620 if for every `y,z \in L, y \leq z`
1620- the equality `(y \vee x) \wedge z = y \vee (x \wedge z)`.
1621+ we have `(y \vee x) \wedge z = y \vee (x \wedge z)`.
16211622
16221623 .. SEEALSO::
16231624
16241625 - Stronger properties: :meth:`is_trim`
16251626
1627+ - :meth:`is_left_modular_element`
1628+
16261629 EXAMPLES:
16271630
16281631 A lattice that is not left-modular::
@@ -1638,19 +1641,23 @@ def is_left_modular(self, H=None, certificate=False) -> bool | list:
16381641 ....: [[1,2],[1,3],[3,4],[4,5],[2,5],[2,6],[6,5],[2,4]]))
16391642 sage: L.is_left_modular()
16401643 True
1644+
1645+ TESTS::
1646+
1647+ sage: L = LatticePoset(([1,2,3,4,5],
1648+ ....: [[1,2],[1,3],[3,4],[4,5],[2,5]]))
1649+ sage: L.is_left_modular(certificate=True)
1650+ (False, (3, 2, 4))
16411651 """
16421652 if H is None :
16431653 H = self
1644- out = []
16451654 for x in H :
16461655 for z in self :
16471656 mxz = self .meet (x , z )
16481657 for y in self .lower_covers_iterator (z ):
16491658 if self .join (y , mxz ) != self .meet (self .join (y , x ), z ):
1650- if not certificate :
1651- return False
1652- out .append ((y , x , z ))
1653- return out if certificate else True
1659+ return False if not certificate else (False , (y , x , z ))
1660+ return (True , None ) if certificate else True
16541661
16551662 def is_complemented (self , certificate = False ) -> bool | tuple :
16561663 r"""
@@ -2791,6 +2798,8 @@ def is_left_modular_element(self, x) -> bool:
27912798 .. SEEALSO::
27922799
27932800 - Stronger properties: :meth:`is_modular_element`
2801+
2802+ - :meth:`is_left_modular`
27942803 """
27952804 return all (self .meet (self .join (y , x ), z ) ==
27962805 self .join (y , self .meet (x , z ))
0 commit comments