diff --git a/Project.toml b/Project.toml index 80e4762..fa9a1ea 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ImplicitEquations" uuid = "95701278-4526-5785-aba3-513cca398f19" -version = "1.0.1" +version = "1.0.2" [deps] IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253" diff --git a/src/predicates.jl b/src/predicates.jl index 1738fd5..86ed03b 100644 --- a/src/predicates.jl +++ b/src/predicates.jl @@ -29,7 +29,7 @@ To negate a predicate, `!` is used. """ mutable struct Pred <: Predicate - f::Function + f op val end @@ -46,25 +46,25 @@ preds = [(:Lt, :≪, :<), # \ll for (fn, uop, op) in preds fnname = string(fn) @eval begin - ($fn)(f::Function, x::Real) = Pred(f, $op, x) - ($uop)(f::Function, x::Real) = ($fn)(f, x) - ($fn)(f::Function, g::Function) = $(fn)((x,y) -> f(x,y) - g(x,y), 0) - ($uop)(f::Function, g::Function) = ($fn)(f, g) + ($fn)(f, x::Real) = Pred(f, $op, x) + ($uop)(f, x::Real) = ($fn)(f, x) + ($fn)(f, g) = $(fn)((x,y) -> f(x,y) - g(x,y), 0) + ($uop)(f, g) = ($fn)(f, g) end eval(Expr(:export, fn)) eval(Expr(:export, uop)) end -Neq(f::Function, x::Real) = Pred(f, !== , x) -Neq(f::Function, g::Function) = Neq((x,y) -> f(x,y) - g(x,y), 0) +Neq(f, x::Real) = Pred(f, !== , x) +Neq(f, g) = Neq((x,y) -> f(x,y) - g(x,y), 0) ≶(x::Real, y::Real) = (x != y) -≶(f::Function, x::Real) = Neq(f, x) -≶(f::Function, g::Function) = Neq(f, g) +≶(f, x::Real) = Neq(f, x) +≶(f, g) = Neq(f, g) ≷(x::Real, y::Real) = (x != y) -≷(f::Function, x::Real) = Neq(f, x) -≷(f::Function, g::Function) = Neq(f, g) +≷(f, x::Real) = Neq(f, x) +≷(f, g) = Neq(f, g) diff --git a/test/runtests.jl b/test/runtests.jl index cdd0762..0a1fe88 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -15,3 +15,9 @@ ImplicitEquations.GRAPH(Neq(f, g), -5, 5, -5, 5, 2^4, 2^4) ImplicitEquations.GRAPH(Eq(f, g), -5, 5, -5, 5, 2^4, 2^4) ImplicitEquations.GRAPH(f ⩵ g, -5, 5, -5, 5, 2^4, 2^4) + + +# Issue #30: relax assumptions in predicates +struct F end +(::F)(x,y) = x^2 + y^2 +ImplicitEquations.GRAPH(f ⩵ 0, -5, 5, -5, 5, 2^4, 2^4)