On Sat, 13 Jun 2015, Johan S. R. Nielsen wrote:
At least for now we don't have parameter like
trust_me_i_know_what_i_am_doing=True for posets or lattices.
Such a parameter would make lots of sense, I think.
I have thinked about it. It needs some more thinking - how much should be
trusted? But at least for lattices it could just override the check of
DiGraph being a lattice. Posets are maybe harder part.
This can be seen for example with C500=Posets.ChainPoset(500)
(Funnier example is C500.is_lattice() taking few seconds, even if it's
class is lattice.)
??? Why is is_lattice not overwritten by FiniteLatticePoset?
I don't know if that would be used feature... But let's suppose that a
function f returns a poset with at least elements 1 and 2. We want to
print "foo" if the poset is not a lattice and join of 1 and 2 if it is.
P = f(x)
if P.is_lattice():
L = LatticePoset(L)
print L.join(1, 2)
else:
print "foo"
First Sage tries to compute meet- and join-matrix to see if P is a
lattice. If it is, then they are computed again when making L from P. And
then third time - now only join-matrix - when printing join of 1 and 2.
Advanced user migth say try: L = LatticePoset(P) and catch ValueError. So
maybe for is_lattice() it is good to throw away just computed matrices.
But when creating a lattice it feels unnecessary. Why to make a lattice if
not for computing meets and joins? And in any case advanced user can say -
after reading the code - something like unset(L._meet) or so.
Yes, if the choises are - and will be - a list and a lattice. But maybe
somebody wants to return a poset or a set?
A lattice can be trivially converted to a poset or set. So if
construction of the lattice object is cheap
Will be cheap, if we have the parameter to override checks.
--
Jori Mäntysalo