(** Take-home Exercise [subst_open_rec] *)
(** The next lemma demonstrates that free variable substitution distributes over index substitution.  The proof of this lemma is by straightforward induction over [e1]. When [e1] is a free variable, we need to appeal to [open_rec_lc], proved above. *)

(* Specifications: *)
Lemma subst_open_rec : forall e1 e2 u (x : atom) k,
lc u ->
[x ~> u] ({k ~> e2} e1) = {k ~> [x ~> u] e2} ([x ~> u] e1).
Lemma subst_open_rec : forall e1 e2 u (x : atom) k,
lc u ->
[x ~> u] ({k ~> e2} e1) = {k ~> [x ~> u] e2} ([x ~> u] e1).