# Designing less than and less than or equal operators for Map with value being a Set

I am trying to come up with less than and less than or equals operators for a Map where values are Sets. These are the hints I was able to get from the Professor.

{A -> {1,2}, B -> {3,4}} < {A -> {1,2}, B -> {3,4}, C -> {5,6}}

{A -> {1,2}, B -> {3,4}} < {A -> {1,2}, B -> {3,4,5}}


val v_compare = (x, y) => (x.keySet intersect y.keySet).forall(key => x(key) subsetOf y(key))

val v_compare_equal = v_compare


I am wondering can I get some hints? I don't know what should the "<=" be

I think that actual code is off-topic here. In general you can define a strict total order relation on (sub)sets of a known universe $$U$$: pick an arbitrary order for the elements of $$U$$ then, given two distinct subsets $$X,Y$$ of $$U$$, you can compare $$X$$ and $$Y$$ by first sorting the elements of $$X$$ (resp. $$Y$$) and then comparison the sorted version of $$X$$ with the sorted version of $$Y$$ lexicographically.