# Verifying inequalities

I would like to give SageMath some inequalities, and then ask it if other inequalities follow from them.

For example, I would like to tell SageMath "a > 2b > 0" and then ask it whether "a - b > b/2" and the answer should be "True", but if I ask whether "a - b > 3b/2" the answer should be "False" (since it is not implied by the given inequalities).

How can I do this?

edit retag close merge delete

Sort by » oldest newest most voted

If the inequalities are linear (as in your example), you can define a polyhedron P from them. Then given a new inequality, it also defines a polyhedron Q (a half space), and ask wether this new polyhedron Q contains the initial one P.

You can define polytopes fro inequalities using the Polyhedron(ieqs=...) syntax, see, for example:

To test that Q contains P, you can do:

sage: P.intersection(Q) == P


Note that inequalities have to be large (<=), not strict (<). If you absolutely want to test strict inequalities, you can use vertices and test inclusion in the interior, using P.interior_contains method.

more