code: def respects(g,imp):
      
      if isinstance(g,str):
          g = int(g,2)
      if isinstance(imp,int):
          imp = istr(imp,3,g.bit_length())
      V = int(imp.replace('1','2').replace('2','1'),2)
      U = int(imp.replace('1','0').replace('2','1'),2)
      ginU = U&g == U
      ginV = V&g == V
      return not ginU or ginV
docs: g is an int, where each bit is an attribute
      implication UV is ternary coded 1 = ∈V, 2 = ∈U, 0 otherwise
      g and UV have the same number of digits