1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "basic_2/notation/relations/leqdx_3.ma".
16 include "basic_2/grammar/lenv_length.ma".
18 (* DX GUARDED EQUIVALENCE FOR LOCAL ENVIRONMENTS ****************************)
20 inductive leqdx: nat → relation lenv ≝
21 | leqdx_atom: ∀d. leqdx d (⋆) (⋆)
22 | leqdx_zero: ∀I1,I2,L1,L2,V1,V2.
23 leqdx 0 L1 L2 → leqdx 0 (L1.ⓑ{I1}V1) (L2.ⓑ{I2}V2)
24 | leqdx_succ: ∀I,L1,L2,V,d.
25 leqdx d L1 L2 → leqdx (d+1) (L1.ⓑ{I}V) (L2.ⓑ{I}V)
29 "guarded equivalence (local environment, dx variant)"
30 'LEqDx d L1 L2 = (leqdx d L1 L2).
32 (* Basic properties *********************************************************)
34 lemma leqdx_O: ∀L1,L2. |L1| = |L2| → L1 ≚[0] L2.
36 [ #L2 #H >(length_inv_zero_sn … H) -L2 //
37 | #L1 #I1 #V1 #IHL1 #X #H elim (length_inv_pos_sn … H) -H
38 #I2 #L2 #V2 #HL12 #H destruct /3 width=1 by leqdx_zero/
42 (* Basic inversion lemmas ***************************************************)
44 fact leqdx_inv_succ2_aux: ∀L1,L2,d. L1 ≚[d] L2 →
45 ∀I,K2,V,e. L2 = K2.ⓑ{I}V → d = e + 1 →
46 ∃∃K1. K1 ≚[e] K2 & L1 = K1.ⓑ{I}V.
47 #L1 #L2 #d * -L1 -L2 -d
48 [ #d #J #K2 #W #e #H destruct
49 | #I1 #I2 #L1 #L2 #V1 #V2 #_ #J #K2 #W #e #_
50 >commutative_plus normalize #H destruct
51 | #I #L1 #L2 #V #d #HL12 #J #K2 #W #e #H1 #H2 destruct
52 /2 width=3 by ex2_intro/
56 lemma leqdx_inv_succ2: ∀I,L1,K2,V,d. L1 ≚[d+1] K2.ⓑ{I}V →
57 ∃∃K1. K1 ≚[d] K2 & L1 = K1.ⓑ{I}V.
58 /2 width=5 by leqdx_inv_succ2_aux/ qed-.