Skip to content

Commit

Permalink
Merge pull request #3663 from JuliaReach/schillic/emptyset
Browse files Browse the repository at this point in the history
`EmptySet` minor revision
  • Loading branch information
schillic authored Dec 12, 2024
2 parents a876c7c + 94a7e6c commit ea04603
Show file tree
Hide file tree
Showing 27 changed files with 65 additions and 403 deletions.
53 changes: 27 additions & 26 deletions docs/src/lib/sets/EmptySet.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,9 @@ EmptySet
## Operations

```@docs
an_element(::EmptySet)
area(::EmptySet)
chebyshev_center_radius(::EmptySet; kwargs...)
complement(::EmptySet{N}) where {N}
diameter(::EmptySet, ::Real=Inf)
dim(::EmptySet)
high(::EmptySet)
high(::EmptySet, ::Int)
isbounded(::EmptySet)
isempty(::EmptySet)
isuniversal(::EmptySet{N}, ::Bool=false) where {N}
low(::EmptySet)
low(::EmptySet, ::Int)
norm(::EmptySet, ::Real=Inf)
radius(::EmptySet, ::Real=Inf)
rand(::Type{EmptySet})
rectify(::EmptySet)
reflect(::EmptySet)
vertices_list(::EmptySet)
vertices(::EmptySet)
volume(::EmptySet{N}) where {N}
∈(::AbstractVector, ::EmptySet)
linear_map(::AbstractMatrix, ::EmptySet)
ρ(::AbstractVector, ::EmptySet)
σ(::AbstractVector, ::EmptySet)
translate(::EmptySet, ::AbstractVector)
plot_recipe(::EmptySet{N}, ::Any=zero(N)) where {N}
```

Expand All @@ -46,15 +23,36 @@ CurrentModule = LazySets.API
```

Undocumented implementations:

* [`an_element`](@ref an_element(::LazySet))
* [`area`](@ref area(::LazySet))
* [`convex_hull`](@ref convex_hull(::LazySet))
* [`diameter`](@ref diameter(::LazySet, ::Real=Inf))
* [`dim`](@ref dim(::LazySet))
* [`high`](@ref high(::LazySet))
* [`high`](@ref high(::LazySet, ::Int))
* [`isbounded`](@ref isbounded(::LazySet))
* [`isboundedtype`](@ref isboundedtype(::Type{LazySet}))
* [`isconvextype`](@ref isconvextype(::Type{LazySet}))
* [`isempty`](@ref isempty(::LazySet))
* [`isoperationtype`](@ref isoperationtype(::Type{LazySet}))
* [`affine_map`](@ref affine_map(::AbstractMatrix, ::LazySet, ::AbstractVector))
* [`exponential_map`](@ref exponential_map(::AbstractMatrix, ::LazySet))
* [`is_interior_point`](@ref is_interior_point(::AbstractVector, ::LazySet))
* [`isuniversal`](@ref isuniversal(::LazySet, ::Bool=false))
* [`low`](@ref low(::LazySet))
* [`low`](@ref low(::LazySet, ::Int))
* [`norm`](@ref norm(::LazySet, ::Real=Inf))
* [`radius`](@ref radius(::LazySet, ::Real=Inf))
* [`rectify`](@ref rectify(::LazySet))
* [`reflect`](@ref reflect(::LazySet))
* [`vertices_list`](@ref vertices_list(::LazySet))
* [`vertices`](@ref vertices(::LazySet))
* [`volume`](@ref volume(::LazySet))
* [``](@ref ∈(::AbstractVector, ::LazySet))
* [`linear_map`](@ref linear_map(::AbstractMatrix, ::LazySet))
* [`ρ`](@ref ρ(::AbstractVector, ::LazySet))
* [`σ`](@ref σ(::AbstractVector, ::LazySet))
* [`scale`](@ref scale(::Real, ::LazySet))
* [`scale!`](@ref scale!(::Real, ::LazySet))
* [`translate`](@ref translate(::LazySet, ::AbstractVector))
* [`translate!`](@ref translate!(::LazySet, ::AbstractVector))
* [`convex_hull`](@ref convex_hull(::LazySet, ::LazySet))
* [`intersection`](@ref isequivalent(::LazySet, ::LazySet))
Expand All @@ -75,6 +73,9 @@ Inherited from [`LazySet`](@ref):
* [`ispolyhedral`](@ref ispolyhedral(::LazySet))
* [`singleton_list`](@ref singleton_list(::LazySet))
* [`surface`](@ref surface(::LazySet))
* [`affine_map`](@ref affine_map(::AbstractMatrix, ::LazySet, ::AbstractVector))
* [`exponential_map`](@ref exponential_map(::AbstractMatrix, ::LazySet))
* [`is_interior_point`](@ref is_interior_point(::AbstractVector, ::LazySet))
* [`cartesian_product`](@ref cartesian_product(::LazySet, ::LazySet))
* [``](@ref ≈(::LazySet, ::LazySet))
* [`==`](@ref ==(::LazySet, ::LazySet))
Expand Down
15 changes: 1 addition & 14 deletions src/Sets/EmptySet/an_element.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
"""
an_element(∅::EmptySet)
Return some element of an empty set.
### Input
- `∅` -- empty set
### Output
An error.
"""
function an_element(::EmptySet)
return error("an empty set does not contain any element")
throw(ArgumentError("an empty set does not contain any element"))
end
13 changes: 0 additions & 13 deletions src/Sets/EmptySet/area.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
"""
area(∅::EmptySet)
Return the area of an empty set.
### Input
- `∅` -- empty set
### Output
``0``.
"""
function area(∅::EmptySet)
N = eltype(∅)
return zero(N)
Expand Down
2 changes: 1 addition & 1 deletion src/Sets/EmptySet/chebyshev_center_radius.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ and the corresponding radius of an empty set.
An error.
"""
function chebyshev_center_radius(∅::EmptySet; kwargs...)
return error("the Chebyshev center and radius of an empty set are undefined")
throw(ArgumentError("the Chebyshev center and radius of an empty set are undefined"))
end
10 changes: 3 additions & 7 deletions src/Sets/EmptySet/complement.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
"""
complement(∅::EmptySet{N}) where {N}
Return the complement of an empty set.
# Extended help
### Input
- `∅` -- empty set
complement(∅::EmptySet{N}) where {N}
### Output
The universe of the same dimension.
The [`Universe`](@ref) of the same dimension.
"""
function complement(∅::EmptySet{N}) where {N}
require(@__MODULE__, :LazySets; fun_name="complement")
Expand Down
10 changes: 9 additions & 1 deletion src/Sets/EmptySet/convex_hull.jl
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
convex_hull(∅::EmptySet, ::EmptySet) =
function convex_hull(∅::EmptySet)
return
end

function convex_hull(∅₁::EmptySet, ∅₂::EmptySet)
@assert dim(∅₁) == dim(∅₂) "cannot take the convex hull between two " *
"empty sets of dimensions $(dim(∅₁)) and $(dim(∅₂))"
return ∅₁
end
19 changes: 1 addition & 18 deletions src/Sets/EmptySet/diameter.jl
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
"""
diameter(∅::EmptySet, [p]::Real=Inf)
Return the diameter of an empty set.
It is the maximum distance between any two elements of the set or, equivalently,
the diameter of the enclosing ball (of the given ``p``-norm) of minimal volume
with the same center.
### Input
- `∅` -- empty set
- `p` -- (optional, default: `Inf`) norm
### Output
An error.
"""
function diameter(::EmptySet, ::Real=Inf)
return error("the diameter of an empty set is undefined")
throw(ArgumentError("the diameter of an empty set is undefined"))
end
13 changes: 0 additions & 13 deletions src/Sets/EmptySet/dim.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
"""
dim(∅::EmptySet)
Return the dimension of an empty set.
### Input
- `∅` -- an empty set
### Output
The dimension of the empty set.
"""
function dim(∅::EmptySet)
return.dim
end
36 changes: 2 additions & 34 deletions src/Sets/EmptySet/high.jl
Original file line number Diff line number Diff line change
@@ -1,39 +1,7 @@
"""
high(∅::EmptySet)
Return a vector with the highest coordinates of an empty set in each canonical
direction.
### Input
- `∅` -- empty set
### Output
An error.
### Notes
See also [`high(∅::EmptySet, i::Int)`](@ref).
"""
function high(::EmptySet)
return error("the upper bound of an empty set is undefined")
throw(ArgumentError("the upper bound of an empty set is undefined"))
end

"""
high(∅::EmptySet, i::Int)
Return the highest coordinate of an empty set in the given direction.
### Input
- `∅` -- empty set
- `i` -- dimension of interest
### Output
An error.
"""
function high(::EmptySet, ::Int)
return error("the upper bound of an empty set is undefined")
throw(ArgumentError("the upper bound of an empty set is undefined"))
end
21 changes: 0 additions & 21 deletions src/Sets/EmptySet/in.jl
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
"""
∈(x::AbstractVector, ∅::EmptySet)
Check whether a given point is contained in an empty set.
### Input
- `x` -- point/vector
- `∅` -- empty set
### Output
`false`.
### Examples
```jldoctest
julia> [1.0, 0.0] ∈ ∅(2)
false
```
"""
function (::AbstractVector, ::EmptySet)
return false
end
13 changes: 0 additions & 13 deletions src/Sets/EmptySet/isbounded.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
"""
isbounded(∅::EmptySet)
Check whether an empty set is bounded.
### Input
- `∅` -- empty set
### Output
`true`.
"""
function isbounded(::EmptySet)
return true
end
13 changes: 0 additions & 13 deletions src/Sets/EmptySet/isempty.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
"""
isempty(∅::EmptySet)
Check if the empty set is empty.
### Input
- `∅` -- empty set
### Output
`true`.
"""
function isempty(::EmptySet)
return true
end
15 changes: 0 additions & 15 deletions src/Sets/EmptySet/isuniversal.jl
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
"""
isuniversal(∅::EmptySet{N}, [witness]::Bool=false) where {N}
Check whether an empty set is universal.
### Input
- `∅` -- empty set
- `witness` -- (optional, default: `false`) compute a witness if activated
### Output
* If `witness` option is deactivated: `false`
* If `witness` option is activated: `(false, v)` where ``v ∉ S``
"""
function isuniversal(∅::EmptySet{N}, witness::Bool=false) where {N}
if witness
return (false, zeros(N, dim(∅)))
Expand Down
16 changes: 1 addition & 15 deletions src/Sets/EmptySet/linear_map.jl
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
"""
linear_map(M::AbstractMatrix{N}, ∅::EmptySet{N}) where {N}
Return the linear map of an empty set.
### Input
- `M` -- matrix
- `∅` -- empty set
### Output
An empty set.
"""
function linear_map(M::AbstractMatrix, ∅::EmptySet)
N = eltype(∅)
@assert size(M, 2) == dim(∅) "cannot apply a $(size(M))-dimensional " *
"matrix to a $(dim(∅))-dimensional set"

N = eltype(∅)
return EmptySet{N}(size(M, 1))
end
36 changes: 2 additions & 34 deletions src/Sets/EmptySet/low.jl
Original file line number Diff line number Diff line change
@@ -1,39 +1,7 @@
"""
low(∅::EmptySet)
Return a vector with the lowest coordinates of an empty set in each canonical
direction.
### Input
- `∅` -- empty set
### Output
An error.
### Notes
See also [`low(∅::EmptySet, i::Int)`](@ref).
"""
function low(::EmptySet)
return error("the lower bound of an empty set is undefined")
throw(ArgumentError("the lower bound of an empty set is undefined"))
end

"""
low(∅::EmptySet, i::Int)
Return the lowest coordinate of an empty set in the given direction.
### Input
- `∅` -- empty set
- `i` -- dimension of interest
### Output
An error.
"""
function low(::EmptySet, ::Int)
return error("the lower bound of an empty set is undefined")
throw(ArgumentError("the lower bound of an empty set is undefined"))
end
18 changes: 1 addition & 17 deletions src/Sets/EmptySet/norm.jl
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
"""
norm(∅::EmptySet, [p]::Real=Inf)
Return the norm of an empty set.
It is the norm of the enclosing ball (of the given ``p``-norm) of minimal volume
that is centered in the origin.
### Input
- `∅` -- empty set
- `p` -- (optional, default: `Inf`) norm
### Output
An error.
"""
function norm(::EmptySet, ::Real=Inf)
return error("the norm of an empty set is undefined")
throw(ArgumentError("the norm of an empty set is undefined"))
end
Loading

0 comments on commit ea04603

Please sign in to comment.