diff --git a/src/IntervalArithmetic.jl b/src/IntervalArithmetic.jl index 72e842ec8..21f487014 100644 --- a/src/IntervalArithmetic.jl +++ b/src/IntervalArithmetic.jl @@ -35,7 +35,7 @@ export @interval, @biginterval, @floatinterval, @make_interval, diam, radius, mid, mag, mig, hull, emptyinterval, ∅, ∞, isempty, isinterior, isdisjoint, ⪽, - precedes, strictprecedes, ≺, + precedes, strictprecedes, ≺, ⊂, ⊃, ⊇, entireinterval, isentire, nai, isnai, isthin, iscommon, isatomic, widen, inf, sup, parameters, eps, dist, diff --git a/src/intervals/set_operations.jl b/src/intervals/set_operations.jl index 86eedf49f..4da83f340 100644 --- a/src/intervals/set_operations.jl +++ b/src/intervals/set_operations.jl @@ -26,6 +26,18 @@ function ⊆(a::Interval, b::Interval) b.lo ≤ a.lo && a.hi ≤ b.hi end +function ⊂(a::Interval, b::Interval) + a == b && return false + a ⊆ b +end + +function ⊇(a::Interval, b::Interval) + b ⊆ a +end + +function ⊃(a::Interval, b::Interval) + b ⊂ a +end # isinterior function isinterior(a::Interval, b::Interval) diff --git a/test/interval_tests/consistency.jl b/test/interval_tests/consistency.jl index e093e2402..cd6d44993 100644 --- a/test/interval_tests/consistency.jl +++ b/test/interval_tests/consistency.jl @@ -93,6 +93,18 @@ c = @interval(0.25, 4.0) @test !(b ⪽ emptyinterval(b)) @test emptyinterval(c) ⪽ c @test emptyinterval(c) ⪽ emptyinterval(c) + @test b ⊂ c + @test !(b ⊂ b) + @test emptyinterval(c) ⊂ c + @test !(c ⊂ emptyinterval(c)) + @test c ⊃ b + @test !(b ⊃ b) + @test !(emptyinterval(c) ⊃ c) + @test c ⊃ emptyinterval(c) + @test c ⊇ b + @test b ⊇ b + @test !(emptyinterval(c) ⊇ c) + @test c ⊇ emptyinterval(c) @test isdisjoint(a, @interval(2.1)) @test !(isdisjoint(a, b)) @test isdisjoint(emptyinterval(a), a)