We know that a & a = a
holds for a Boolean variable a
. However, this rule is missing in SymbolicUtils.jl.
julia> using SymbolicUtils
julia> r = @rule ~x & ~x => ~x
~x & ~x => ~x
julia> @syms a::Bool b::Bool
(a, b)
julia> simplify(a & a; rewriter=r)
a
julia> simplify(a & a & a; rewriter=r)
(a & a) & a
julia> simplify((a & a) & b; rewriter=r)
(a & a) & b
julia> simplify(a & a & a & a; rewriter=r)
((a & a) & a) & a
I do not understand why a & a & a
or (a & a) & b
does not work. I am new to Symbolics in Julia. Any help is appreciated.