- sage: K = random_cone(max_dim=15)
- sage: actual = lyapunov_rank(K)
- sage: K_S = project_span(K)
- sage: P = project_span(K_S.dual()).dual()
- sage: l = K.linear_subspace().dimension()
- sage: codim = K.lattice_dim() - K.dim()
- sage: expected = lyapunov_rank(P) + K.dim()*(l + codim) + codim**2
- sage: actual == expected
- True
+ if m < n:
+ # K is not solid, restrict to its span.
+ K = _restrict_to_space(K, K.span())
+
+ # Non-solid reduction lemma.
+ beta += (n - m)*n
+
+ if l > 0:
+ # K is not pointed, restrict to the span of its dual. Uses a
+ # proposition from our paper, i.e. this is equivalent to K =
+ # _rho(K.dual()).dual().
+ K = _restrict_to_space(K, K.dual().span())
+
+ # Non-pointed reduction lemma.
+ beta += l * m
+
+ beta += len(LL(K))
+ return beta
+
+
+
+def is_lyapunov_like(L,K):
+ r"""
+ Determine whether or not ``L`` is Lyapunov-like on ``K``.
+
+ We say that ``L`` is Lyapunov-like on ``K`` if `\left\langle
+ L\left\lparenx\right\rparen,s\right\rangle = 0` for all pairs
+ `\left\langle x,s \right\rangle` in the complementarity set of
+ ``K``. It is known [Orlitzky]_ that this property need only be
+ checked for generators of ``K`` and its dual.
+
+ INPUT:
+
+ - ``L`` -- A linear transformation or matrix.
+
+ - ``K`` -- A polyhedral closed convex cone.
+
+ OUTPUT:
+
+ ``True`` if it can be proven that ``L`` is Lyapunov-like on ``K``,
+ and ``False`` otherwise.
+
+ .. WARNING::
+
+ If this function returns ``True``, then ``L`` is Lyapunov-like
+ on ``K``. However, if ``False`` is returned, that could mean one
+ of two things. The first is that ``L`` is definitely not
+ Lyapunov-like on ``K``. The second is more of an "I don't know"
+ answer, returned (for example) if we cannot prove that an inner
+ product is zero.
+
+ REFERENCES:
+
+ .. [Orlitzky] M. Orlitzky. The Lyapunov rank of an
+ improper cone (preprint).
+
+ EXAMPLES:
+
+ todo.
+
+ TESTS:
+
+ todo.