+ If the base ring of ``L`` is ``SR``, then the situation is more
+ complicated:
+
+ - ``True`` will be returned if it can be proven that ``L``
+ is Lyapunov-like on ``K``.
+ - ``False`` will be returned if it can be proven that ``L``
+ is not Lyapunov-like on ``K``.
+ - ``False`` will also be returned if we can't decide; specifically
+ if we arrive at a symbolic inequality that cannot be resolved.
+
+ EXAMPLES:
+
+ Diagonal matrices are Lyapunov-like operators on the nonnegative
+ orthant::
+
+ sage: K = Cone([(1,0,0),(0,1,0),(0,0,1)])
+ sage: L = diagonal_matrix(random_vector(QQ,3))
+ sage: is_lyapunov_like_on(L,K)
+ True
+
+ TESTS:
+
+ The identity operator is always Lyapunov-like::
+
+ sage: set_random_seed()
+ sage: K = random_cone(max_ambient_dim=8)
+ sage: L = identity_matrix(K.lattice_dim())
+ sage: is_lyapunov_like_on(L,K)
+ True
+
+ The "zero" operator is always Lyapunov-like::
+
+ sage: K = random_cone(max_ambient_dim=8)
+ sage: R = K.lattice().vector_space().base_ring()
+ sage: L = zero_matrix(R, K.lattice_dim())
+ sage: is_lyapunov_like_on(L,K)
+ True
+
+ Everything in ``K.lyapunov_like_basis()`` should be Lyapunov-like
+ on ``K``::
+
+ sage: K = random_cone(max_ambient_dim=5)
+ sage: all([ is_lyapunov_like_on(L,K) # long time
+ ....: for L in K.lyapunov_like_basis() ]) # long time
+ True
+ sage: all([ is_lyapunov_like_on(L.change_ring(SR),K) # long time
+ ....: for L in K.lyapunov_like_basis() ]) # long time
+ True
+
+ """
+ if not is_Cone(K):
+ raise TypeError('K must be a Cone')
+ if not L.base_ring().is_exact() and not L.base_ring() is SR:
+ raise ValueError('base ring of operator L is neither SR nor exact')
+
+ return all([ s*(L*x) == 0
+ for (x,s) in K.discrete_complementarity_set() ])
+
+
+def LL_cone(K):
+ gens = K.lyapunov_like_basis()
+ L = ToricLattice(K.lattice_dim()**2)
+ return Cone([ g.list() for g in gens ], lattice=L, check=False)
+
+def Sigma_cone(K):
+ gens = K.cross_positive_operators_gens()
+ L = ToricLattice(K.lattice_dim()**2)
+ return Cone([ g.list() for g in gens ], lattice=L, check=False)
+
+def Z_cone(K):
+ gens = K.Z_operators_gens()
+ L = ToricLattice(K.lattice_dim()**2)
+ return Cone([ g.list() for g in gens ], lattice=L, check=False)
+
+def pi_cone(K1, K2=None):
+ if K2 is None:
+ K2 = K1
+ gens = K1.positive_operators_gens(K2)
+ L = ToricLattice(K1.lattice_dim()*K2.lattice_dim())
+ return Cone([ g.list() for g in gens ], lattice=L, check=False)