Working implementatio of sub/super-bag/set logic