Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add special cases for disjointness and inclusion involving universe #2964

Merged
merged 3 commits into from
May 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/ConcreteOperations/isdisjoint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1373,3 +1373,22 @@ end
@inline function _det(L1::Line2D, L2::Line2D)
@inbounds det = L1.a[1] * L2.a[2] - L1.a[2] * L2.a[1]
end

for ST in (AbstractZonotope, AbstractSingleton)
@eval @commutative function isdisjoint(C::CartesianProduct{N, <:LazySet, <:Universe}, Z::$(ST)) where N
X = C.X
Zp = project(Z, 1:dim(X))
return isdisjoint(X, Zp)
end

@eval @commutative function isdisjoint(C::CartesianProduct{N, <:Universe, <:LazySet}, Z::$(ST)) where N
Y = C.Y
Zp = project(Z, dim(C.X)+1:dim(C))
return isdisjoint(Y, Zp)
end

# disambiguation
@eval @commutative function isdisjoint(C::CartesianProduct{N, <:Universe, <:Universe}, Z::$(ST)) where N
return false
end
end
19 changes: 19 additions & 0 deletions src/ConcreteOperations/issubset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1091,3 +1091,22 @@ function ⊆(Z::AbstractZonotope, H::AbstractHyperrectangle, witness::Bool=false
end
return true
end

for ST in (AbstractZonotope, AbstractSingleton, LineSegment)
@eval function ⊆(Z::$(ST), C::CartesianProduct{N, <:LazySet, <:Universe}) where N
X = C.X
Zp = project(Z, 1:dim(X))
return ⊆(Zp, X)
end

@eval function ⊆(Z::$(ST), C::CartesianProduct{N, <:Universe, <:LazySet}) where N
Y = C.Y
Zp = project(Z, dim(C.X)+1:dim(C))
return ⊆(Zp, Y)
end

# disambiguation
@eval function ⊆(Z::$(ST), C::CartesianProduct{N, <:Universe, <:Universe}) where N
return true
end
end
mforets marked this conversation as resolved.
Show resolved Hide resolved