No, of course. In the way I had defined the relation is not of equivalence as it has no transitive property (as pointed out by @stevengj).
I just tried to explain (I use Google Translate to write in English :)) what I had improperly tried to do.
I finally realized that I couldn’t do what I wanted using the Dict structure.
Below is an example, following your instructions
julia> using IntervalArithmetic
julia> import Base: hash,==, isequal
julia> hash(a::Interval) = hash(a.lo-a.hi)
hash (generic function with 102 methods)
julia> ==(a::Interval, b::Interval) = a.lo-a.hi == b.lo - b.hi
== (generic function with 188 methods)
julia> isequal(a::Interval, b::Interval) = isequal(a.lo-a.hi, b.lo - b.hi)
isequal (generic function with 29 methods)
julia> a=Interval(0,2)
[0, 2]
julia> b=Interval(2,4)
[2, 4]
julia> c=Interval(-3,-1)
[-3, -1]
julia> da=Dict(a=>"a")
Dict{Interval{Float64}, String} with 1 entry:
[0, 2] => "a"
julia> dc=Dict(c=>'c')
Dict{Interval{Float64}, Char} with 1 entry:
[-3, -1] => 'c'
julia> db=Dict(b=>'b')
Dict{Interval{Float64}, Char} with 1 entry:
[2, 4] => 'b'
julia> mergewith((x...)->join(x,'-'), da,db,dc)
Dict{Interval{Float64}, Any} with 1 entry:
[0, 2] => "a-b-c"