]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/syntax/lveq.ma
8cd00ab86a4d4b9fc84c13c6b447eef91cd52554
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / syntax / lveq.ma
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/voidstareq_4.ma".
16 include "basic_2/syntax/lenv.ma".
17
18 (* EQUIVALENCE FOR LOCAL ENVIRONMENTS UP TO EXCLUSION BINDERS ***************)
19
20 inductive lveq: bi_relation nat lenv ≝
21 | lveq_atom   : lveq 0 (⋆) 0 (⋆)
22 | lveq_pair_sn: ∀I1,I2,K1,K2,V1,n. lveq n K1 n K2 →
23                 lveq 0 (K1.ⓑ{I1}V1) 0 (K2.ⓘ{I2})
24 | lveq_pair_dx: ∀I1,I2,K1,K2,V2,n. lveq n K1 n K2 →
25                 lveq 0 (K1.ⓘ{I1}) 0 (K2.ⓑ{I2}V2)
26 | lveq_void_sn: ∀K1,K2,n1,n2. lveq n1 K1 n2 K2 →
27                 lveq (⫯n1) (K1.ⓧ) n2 K2
28 | lveq_void_dx: ∀K1,K2,n1,n2. lveq n1 K1 n2 K2 →
29                 lveq n1 K1 (⫯n2) (K2.ⓧ)
30 .
31
32 interpretation "equivalence up to exclusion binders (local environment)"
33    'VoidStarEq L1 n1 n2 L2 = (lveq n1 L1 n2 L2).
34
35 (* Basic properties *********************************************************)
36
37 lemma lveq_refl: ∀L. ∃n. L ≋ⓧ*[n, n] L.
38 #L elim L -L /2 width=2 by ex_intro, lveq_atom/
39 #L #I * #n #IH cases I -I /3 width=2 by ex_intro, lveq_pair_dx/
40 * /4 width=2 by ex_intro, lveq_void_sn, lveq_void_dx/
41 qed-.
42
43 lemma lveq_sym: bi_symmetric … lveq.
44 #n1 #n2 #L1 #L2 #H elim H -L1 -L2 -n1 -n2
45 /2 width=2 by lveq_atom, lveq_pair_sn, lveq_pair_dx, lveq_void_sn, lveq_void_dx/
46 qed-.
47
48 (* Basic inversion lemmas ***************************************************)
49
50 fact lveq_inv_atom_aux: ∀L1,L2,n1,n2. L1 ≋ⓧ*[n1, n2] L2 →
51                         ⋆ = L1 → ⋆ = L2 → ∧∧ 0 = n1 & 0 = n2.
52 #L1 #L2 #n1 #n2 * -L1 -L2 -n1 -n2
53 [ /2 width=1 by conj/
54 |2,3: #I1 #I2 #K1 #K2 #V #n #_ #H1 #H2 destruct
55 |4,5: #K1 #K2 #n1 #n2 #_ #H1 #H2 destruct
56 ]
57 qed-.
58
59 (* Advanced inversion lemmas ************************************************)
60
61 lemma lveq_inv_atom: ∀n1,n2. ⋆ ≋ⓧ*[n1, n2] ⋆ → 0 = n1 ∧ 0 = n2.
62 /2 width=5 by lveq_inv_atom_aux/ qed-.
63
64 fact lveq_inv_void_succ_sn_aux: ∀L1,L2,n1,n2. L1 ≋ⓧ*[n1, n2] L2 →
65                                 ∀K1,m1. L1 = K1.ⓧ → n1 = ⫯m1 → K1 ≋ ⓧ*[m1, n2] L2.
66 #L1 #L2 #n1 #n2 #H elim H -L1 -L2 -n1 -n2
67 [ #K2 #m2 #H destruct
68 | #I1 #I2 #L1 #L2 #V #n #_ #_ #K1 #m1 #H1 #H2 destruct
69 | #I1 #I2 #L1 #L2 #V #n #_ #_ #K1 #m1 #H1 #H2 destruct
70 | #L1 #L2 #n1 #n2 #HL12 #_ #K1 #m1 #H1 #H2 destruct //
71 | #L1 #L2 #n1 #n2 #_ #IH #K1 #m1 #H1 #H2 destruct
72   /3 width=1 by lveq_void_dx/
73 ]
74 qed-.
75
76 lemma lveq_inv_void_succ_sn: ∀L1,L2,n1,n2. L1.ⓧ ≋ⓧ*[⫯n1, n2] L2 → L1 ≋ ⓧ*[n1, n2] L2.
77 /2 width=5 by lveq_inv_void_succ_sn_aux/ qed-.
78
79 lemma lveq_inv_void_succ_dx: ∀L1,L2,n1,n2. L1 ≋ⓧ*[n1, ⫯n2] L2.ⓧ → L1 ≋ ⓧ*[n1, n2] L2.
80 /4 width=5 by lveq_inv_void_succ_sn_aux, lveq_sym/ qed-.
81
82 (* Advanced forward lemmas **************************************************)
83
84 fact lveq_fwd_pair_sn_aux: ∀L1,L2,n1,n2. L1 ≋ⓧ*[n1, n2] L2 →
85                            ∀I,K1,V. K1.ⓑ{I}V = L1 → 0 = n1.
86 #L1 #L2 #n1 #n2 #H elim H -L1 -L2 -n1 -n2 //
87 #K1 #K2 #n1 #n2 #_ #IH #J #L1 #V #H destruct /2 width=4 by/
88 qed-.
89
90 lemma lveq_fwd_pair_sn: ∀I,K1,L2,V,n1,n2. K1.ⓑ{I}V ≋ⓧ*[n1, n2] L2 → 0 = n1.
91 /2 width=8 by lveq_fwd_pair_sn_aux/ qed-.
92
93 lemma lveq_fwd_pair_dx: ∀I,L1,K2,V,n1,n2. L1 ≋ⓧ*[n1, n2] K2.ⓑ{I}V → 0 = n2.
94 /3 width=6 by lveq_fwd_pair_sn, lveq_sym/ qed-.