(*************************************************************************)
(*************************************************************************)
(** * LN specific operations and relations *)
(*************************************************************************)
(*************************************************************************)
(** Because we are working with a locally nameless representation, we have a few more operations to consider when working with these terms. *)
(*************************************************************************)
(** ** Opening *)
(*************************************************************************)
(** Opening replaces an index with a term and is defined in the Definitions module. *)
(** This next demo shows the operation of [open].  For example, the locally nameless representation of the term [(\y. (\x. (y x)) y)] is [abs (app (abs (app 1 0)) 0)].  To look at the body _without_ the outer abstraction, we need to replace the indices that refer to that abstraction with a name.  Therefore, we show that we can open the body of the abs above with [Y] to produce [app (abs (app Y 0)) Y)]. *)

Lemma demo_open :
(app (abs (app (var_b 1) (var_b 0))) (var_b 0)) ^ Y =
(app (abs (app (var_f Y) (var_b 0))) (var_f Y)).