let rec apply_bindings xts p =
    match xts with
      | [] -> p
      | (x,t)::xts -> apply_bindings xts (subst x t p)