--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/notation/relations/leqdx_3.ma".
+include "basic_2/grammar/lenv_length.ma".
+
+(* DX GUARDED EQUIVALENCE FOR LOCAL ENVIRONMENTS ****************************)
+
+inductive leqdx: nat → relation lenv ≝
+| leqdx_atom: ∀d. leqdx d (⋆) (⋆)
+| leqdx_zero: ∀I1,I2,L1,L2,V1,V2.
+ leqdx 0 L1 L2 → leqdx 0 (L1.ⓑ{I1}V1) (L2.ⓑ{I2}V2)
+| leqdx_succ: ∀I,L1,L2,V,d.
+ leqdx d L1 L2 → leqdx (d+1) (L1.ⓑ{I}V) (L2.ⓑ{I}V)
+.
+
+interpretation
+ "guarded equivalence (local environment, dx variant)"
+ 'LEqDx d L1 L2 = (leqdx d L1 L2).
+
+(* Basic properties *********************************************************)
+
+lemma leqdx_O: ∀L1,L2. |L1| = |L2| → L1 ≚[0] L2.
+#L1 elim L1 -L1
+[ #L2 #H >(length_inv_zero_sn … H) -L2 //
+| #L1 #I1 #V1 #IHL1 #X #H elim (length_inv_pos_sn … H) -H
+ #I2 #L2 #V2 #HL12 #H destruct /3 width=1 by leqdx_zero/
+]
+qed.
+
+(* Basic inversion lemmas ***************************************************)
+
+fact leqdx_inv_succ2_aux: ∀L1,L2,d. L1 ≚[d] L2 →
+ ∀I,K2,V,e. L2 = K2.ⓑ{I}V → d = e + 1 →
+ ∃∃K1. K1 ≚[e] K2 & L1 = K1.ⓑ{I}V.
+#L1 #L2 #d * -L1 -L2 -d
+[ #d #J #K2 #W #e #H destruct
+| #I1 #I2 #L1 #L2 #V1 #V2 #_ #J #K2 #W #e #_
+ >commutative_plus normalize #H destruct
+| #I #L1 #L2 #V #d #HL12 #J #K2 #W #e #H1 #H2 destruct
+ /2 width=3 by ex2_intro/
+]
+qed-.
+
+lemma leqdx_inv_succ2: ∀I,L1,K2,V,d. L1 ≚[d+1] K2.ⓑ{I}V →
+ ∃∃K1. K1 ≚[d] K2 & L1 = K1.ⓑ{I}V.
+/2 width=5 by leqdx_inv_succ2_aux/ qed-.