let compare_prop_id pid1 pid2 =
  (* This order of compatison groups together prop_pids with same properties *)
  let p1 = property_of_id pid1 in
  let p2 = property_of_id pid2 in
  let cmp = Property.compare p1 p2 in
  if cmp <> 0 then cmp
  else
    let cmp = kind_order pid2.p_kind - kind_order pid1.p_kind in
    if cmp <> 0 then cmp
    else
      Pervasives.compare pid1.p_part pid2.p_part