(* Hence, [lookup (shift y x) (insert y a e) = lookup x e]. *)
Ltac lookup_insert :=
first [
rewrite lookup_insert_bingo by omega
| rewrite lookup_insert_old by omega; one_plus_x_minus_one
| rewrite lookup_insert_recent by omega
| rewrite lookup_shift_insert
].
Ltac lookup_insert_all :=
first [
rewrite lookup_insert_bingo in * by omega;
try match goal with h: Some _ = Some _ |- _ => injection h; intro; subst; clear h end
| rewrite lookup_insert_old in * by omega; one_plus_x_minus_one
| rewrite lookup_insert_recent in * by omega
| rewrite lookup_shift_insert in *
].
Hint Extern 1 (lookup _ (raw_insert _ _ _) = _) =>
lookup_insert
: lookup_insert.
Hint Extern 1 (lookup _ _ = _) =>
lookup_insert_all
: lookup_insert.
(* ---------------------------------------------------------------------------- *)
(* Interaction between [map] and [empty]. *)

Lemma map_empty:
forall A B (f : A -> B),
map f (@empty _) = @empty _.