Opened 9 years ago

Closed 9 years ago

# Check if lattices are upper/lower-semimodular and modular

Reported by: Owned by: csar sage-combinat major sage-5.10 combinatorics sd40 sage-5.10.beta3 Alex Csar, Kevin Dilks, Sangwook Kim Frédéric Chapoton N/A

Add is_upper_semimodular, is_lower_semimodular and is_modular to FiniteLatticePoset? class.

Changes _meet and _join in the HasseDiagram? class to lazy attributes, fixing the problem that meets and joins failed to be defined for the dual of a lattice.

### comment:1 Changed 9 years ago by csar

• Description modified (diff)

### comment:2 Changed 9 years ago by csar

• Status changed from new to needs_review

### comment:4 Changed 9 years ago by chapoton

Could you explain what you did in the hasse_diagram file ? What was the bug that you claim to correct ?

### comment:5 Changed 9 years ago by csar

The issue in hasse_diagram was that taking the dual of the lattice somehow created a situation where the dual poset would attempt to take a join, but joins wouldn't be defined.

For example,

```L = LatticePoset({0:[1,2,3],1:[4],2:[4],3:[4]})
P=L.dual()
x=P.random_element()
y=P.random_element()
P.join(x,y)
```

produces

```/Applications/sage-5.3/local/lib/python2.7/site-packages/sage/combinat/posets/lattices.pyc in join(self, x, y)
268         """
269         i, j = map(self._element_to_vertex,(x,y))
--> 270         return self._vertex_to_element(self._hasse_diagram._join[i,j])
271
272 ####################################################################################

AttributeError: 'HasseDiagram' object has no attribute '_join'
```

I must admit I no longer see why the code currently in sage fails to create ` _join ` when it's needed. (I realise I produced the example using 5.3, not 5.4. I don't have 5.4 to hand at the moment.)

### comment:6 Changed 9 years ago by chapoton

Your example has the same behavior in 5.5.rc0.

You should add this example as a doctest, to check that this is no longer the case with the patch.

### comment:7 Changed 9 years ago by csar

• Description modified (diff)

### comment:8 Changed 9 years ago by chapoton

• Description modified (diff)

here is a rebased patch on 5.9.beta0

for the bot:

### comment:9 Changed 9 years ago by chapoton

One question :

are the two lines

```if q==r:
continue
```

(in the is_upper_semimodular method) really needed ?

### comment:10 Changed 9 years ago by chapoton

Ok, here is a new patch, with small changes and more doc.

It seems to be good to go, but let us first wait for the bot report.

### comment:11 Changed 9 years ago by chapoton

• Reviewers set to Frédéric Chapoton
• Status changed from needs_review to positive_review

ok, positive review

### comment:12 Changed 9 years ago by jdemeyer

• Merged in set to sage-5.10.beta3
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.