let intersection = function
 (i1, i2)  ->  if are_disjoint (i1, i2)
                then
                 failwith ("intersection : requires non-disjoint intervals as arguments")
                else
                 let
                  a = if lower_bound (i1) <= lower_bound (i2)
                       then lower_bound (i2)
                       else lower_bound (i1)
                  and
                  b = if upper_bound (i1) <= upper_bound (i2)
                       then upper_bound (i1)
                       else upper_bound (i2)
                 in
                  cons_closed (a, b)