# Obtaining a certain list of posets via SAGE

I want to apply a function to a list of posets with certain properties.

Question : I want the set of all finite poset with a top and buttom that are not lattices and do not have a subposet isomorphic to the diamond poset or the pentagon poset (here pictures of the two lattices: http://i.stack.imgur.com/zC30M.png ). The part without the diamong and pentagon condition should be easy to obtain as follows:

[format_poset(P) for P in posets(n) if P.has_bottom() and P.has_top() and not P.is_lattice()] But I do not know how to tell SAGE the pentagon and diamond condition.

I asked a similar question as this before but now it is not so much about time and it is ok if it works only for posets with at most 8 or 9 points. In general, it would also be interesting to check for a given connected poset whether it has a diamond or pentagon lattice as a subposet. Is there an easy way to do this with SAGE?

Since what you are looking for are exactly distributive lattices, perhaps it would be good to change the title of the question to indicate that this is what is looked for. Something like "Obtaining distributive lattices from a list of posets via SAGE"