]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc/leq/leqdx.etc
- extended multiple substitutions now uses bounds in ynat (ie. they
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc / leq / leqdx.etc
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "basic_2/notation/relations/leqdx_3.ma".
16 include "basic_2/grammar/lenv_length.ma".
17
18 (* DX GUARDED EQUIVALENCE FOR LOCAL ENVIRONMENTS ****************************)
19
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)
26 .
27
28 interpretation
29    "guarded equivalence (local environment, dx variant)"
30    'LEqDx d L1 L2 = (leqdx d L1 L2).
31
32 (* Basic properties *********************************************************)
33
34 lemma leqdx_O: ∀L1,L2. |L1| = |L2| → L1 ≚[0] L2.
35 #L1 elim L1 -L1
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/
39 ]
40 qed.
41
42 (* Basic inversion lemmas ***************************************************)
43
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/
53 ]
54 qed-.
55
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-.