Open goretkin opened 4 years ago
I came across https://github.com/ahumenberger/Z3.jl/blob/c280b1cda96a0bb774adc226f9295b64462de44d/src/Z3.jl#L71 and perhaps a reasonable definition is:
Base.zero(e::Z3.ExprAllocated) = Z3.num_val(Z3.ctx(x), 0, Z3.get_sort(x))
or perhaps
Base.zero(e::Z3.ExprAllocated) = Z3.num_val(Z3.ctx(x), false, Z3.get_sort(x))
If the expression is of sort bool
, it probably makes sense for this to error in some way, since booleans behave differently in Z3 than in julia:
julia> tf = Z3.bool_const(ctx, "tf")
tf
julia> tf * tf
null
julia> tf + tf
null
julia> true * true
true
julia> true + true
2
I wanted to leverage the fallback definition of matrix multiplication in Julia's Base:
but there are some missing definitions:
I can define:
And it works, however I suspect there is a better definition.
I also wanted unary
+
, just for symmetry. I've defined for that: