from util import *


@apply
def apply(gt, le):
    a, x = le.of(LessEqual)
    b, _x = gt.of(Greater)

    if x != _x:
        a, x, _x, b = _x, b, a, x,
        left_open = True
        right_open = False
    else:
        left_open = False
        right_open = True

    assert x == _x

    return Element(x, Interval(a, b, left_open=left_open, right_open=right_open))


@prove
def prove(Eq):
    from axiom import sets
    a, b, x = Symbol(real=True)
    Eq << apply(b > x, a <= x)

    Eq << sets.el_interval.imply.et.apply(Eq[-1])

    Eq << Eq[-1].reversed

    Eq << Eq[-2].reversed


if __name__ == '__main__':
    run()
# created on 2021-04-19
