let envelope = function
 (i1, i2) -> let
              a = if lower_bound (i1) <= lower_bound (i2)
                   then lower_bound (i1)
                   else lower_bound (i2)
              and
              b = if upper_bound (i1) <= upper_bound (i2)
                   then upper_bound (i2)
                   else upper_bound (i1)
             in
              cons_closed (a, b)