]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/static/lfdeq.ma
- lfpxs based on tc_lfxs
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / static / lfdeq.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/lazyeq_5.ma".
16 include "basic_2/syntax/tdeq.ma".
17 include "basic_2/static/lfxs.ma".
18
19 (* DEGREE-BASED EQUIVALENCE FOR LOCAL ENVIRONMENTS ON REFERRED ENTRIES ******)
20
21 definition lfdeq: ∀h. sd h → relation3 term lenv lenv ≝
22                   λh,o. lfxs (cdeq h o).
23
24 interpretation
25    "degree-based equivalence on referred entries (local environment)"
26    'LazyEq h o T L1 L2 = (lfdeq h o T L1 L2).
27
28 interpretation
29    "degree-based ranged equivalence (local environment)"
30    'LazyEq h o f L1 L2 = (lexs (cdeq h o) cfull f L1 L2).
31 (*
32 definition lfdeq_transitive: predicate (relation3 lenv term term) ≝
33            λR. ∀L2,T1,T2. R L2 T1 T2 → ∀L1. L1 ≡[h, o, T1] L2 → R L1 T1 T2.
34 *)
35 (* Basic properties ***********************************************************)
36
37 lemma frees_tdeq_conf_lexs: ∀h,o,f,L1,T1. L1 ⊢ 𝐅*⦃T1⦄ ≡ f → ∀T2. T1 ≡[h, o] T2 →
38                             ∀L2. L1 ≡[h, o, f] L2 → L2 ⊢ 𝐅*⦃T2⦄ ≡ f.
39 #h #o #f #L1 #T1 #H elim H -f -L1 -T1
40 [ #f #I1 #Hf #X #H1 elim (tdeq_fwd_atom1 … H1) -H1
41   #I2 #H1 #Y #H2 lapply (lexs_inv_atom1 … H2) -H2
42   #H2 destruct /2 width=1 by frees_atom/
43 | #f #I #L1 #V1 #s1 #_ #IH #X #H1 elim (tdeq_inv_sort1 … H1) -H1
44   #s2 #d #Hs1 #Hs2 #H1 #Y #H2 elim (lexs_inv_push1 … H2) -H2
45   #L2 #V2 #HL12 #_ #H2 destruct /4 width=3 by frees_sort, tdeq_sort/
46 | #f #I #L1 #V1 #_ #IH #X #H1 >(tdeq_inv_lref1 … H1) -H1
47   #Y #H2 elim (lexs_inv_next1 … H2) -H2
48   #L2 #V2 #HL12 #HV12 #H2 destruct /3 width=1 by frees_zero/
49 | #f #I #L1 #V1 #i #_ #IH #X #H1 >(tdeq_inv_lref1 … H1) -H1
50   #Y #H2 elim (lexs_inv_push1 … H2) -H2
51   #L2 #V2 #HL12 #_ #H2 destruct /3 width=1 by frees_lref/
52 | #f #I #L1 #V1 #l #_ #IH #X #H1 >(tdeq_inv_gref1 … H1) -H1
53   #Y #H2 elim (lexs_inv_push1 … H2) -H2
54   #L2 #V2 #HL12 #_ #H2 destruct /3 width=1 by frees_gref/
55 | #f1V #f1T #f1 #p #I #L1 #V1 #T1 #_ #_ #Hf1 #IHV #IHT #X #H1 elim (tdeq_inv_pair1 … H1) -H1
56   #V2 #T2 #HV12 #HT12 #H1 #L2 #HL12 destruct
57   /6 width=5 by frees_bind, lexs_inv_tl, sle_lexs_trans, sor_inv_sle_dx, sor_inv_sle_sn/
58 | #f1V #f1T #f1 #I #L1 #V1 #T1 #_ #_ #Hf1 #IHV #IHT #X #H1 elim (tdeq_inv_pair1 … H1) -H1
59   #V2 #T2 #HV12 #HT12 #H1 #L2 #HL12 destruct
60   /5 width=5 by frees_flat, sle_lexs_trans, sor_inv_sle_dx, sor_inv_sle_sn/
61 ]
62 qed-.
63
64 lemma frees_tdeq_conf: ∀h,o,f,L,T1. L ⊢ 𝐅*⦃T1⦄ ≡ f →
65                        ∀T2. T1 ≡[h, o] T2 → L ⊢ 𝐅*⦃T2⦄ ≡ f.
66 /3 width=7 by frees_tdeq_conf_lexs, lexs_refl/ qed-.
67
68 lemma frees_lfdeq_conf_lexs: ∀h,o. lexs_frees_confluent (cdeq h o) cfull.
69 /3 width=7 by frees_tdeq_conf_lexs, ex2_intro/ qed-.
70
71 lemma tdeq_lfdeq_conf_sn: ∀h,o. s_r_confluent1 … (cdeq h o) (lfdeq h o).
72 #h #o #L1 #T1 #T2 #HT12 #L2 *
73 /3 width=5 by frees_tdeq_conf, ex2_intro/
74 qed-.
75
76 (* Basic_2A1: uses: lleq_sym *)
77 lemma lfdeq_sym: ∀h,o,T. symmetric … (lfdeq h o T).
78 #h #o #T #L1 #L2 *
79 /4 width=7 by frees_tdeq_conf_lexs, lfxs_sym, tdeq_sym, ex2_intro/
80 qed-.
81
82 lemma lfdeq_atom: ∀h,o,I. ⋆ ≡[h, o, ⓪{I}] ⋆.
83 /2 width=1 by lfxs_atom/ qed.
84
85 (* Basic_2A1: uses: lleq_sort *)
86 lemma lfdeq_sort: ∀h,o,I,L1,L2,V1,V2,s.
87                   L1 ≡[h, o, ⋆s] L2 → L1.ⓑ{I}V1 ≡[h, o, ⋆s] L2.ⓑ{I}V2.
88 /2 width=1 by lfxs_sort/ qed.
89
90 lemma lfdeq_zero: ∀h,o,I,L1,L2,V.
91                   L1 ≡[h, o, V] L2 → L1.ⓑ{I}V ≡[h, o, #0] L2.ⓑ{I}V.
92 /2 width=1 by lfxs_zero/ qed.
93
94 lemma lfdeq_lref: ∀h,o,I,L1,L2,V1,V2,i.
95                   L1 ≡[h, o, #i] L2 → L1.ⓑ{I}V1 ≡[h, o, #⫯i] L2.ⓑ{I}V2.
96 /2 width=1 by lfxs_lref/ qed.
97
98 (* Basic_2A1: uses: lleq_gref *)
99 lemma lfdeq_gref: ∀h,o,I,L1,L2,V1,V2,l.
100                   L1 ≡[h, o, §l] L2 → L1.ⓑ{I}V1 ≡[h, o, §l] L2.ⓑ{I}V2.
101 /2 width=1 by lfxs_gref/ qed.
102
103 lemma lfdeq_pair_repl_dx: ∀h,o,I,L1,L2.∀T:term.∀V,V1.
104                           L1.ⓑ{I}V ≡[h, o, T] L2.ⓑ{I}V1 →
105                           ∀V2. V ≡[h, o] V2 →
106                           L1.ⓑ{I}V ≡[h, o, T] L2.ⓑ{I}V2.
107 /2 width=2 by lfxs_pair_repl_dx/ qed-.
108
109 (* Basic inversion lemmas ***************************************************)
110
111 lemma lfdeq_inv_atom_sn: ∀h,o,Y2. ∀T:term. ⋆ ≡[h, o, T] Y2 → Y2 = ⋆.
112 /2 width=3 by lfxs_inv_atom_sn/ qed-.
113
114 lemma lfdeq_inv_atom_dx: ∀h,o,Y1. ∀T:term. Y1 ≡[h, o, T] ⋆ → Y1 = ⋆.
115 /2 width=3 by lfxs_inv_atom_dx/ qed-.
116
117 lemma lfdeq_inv_zero: ∀h,o,Y1,Y2. Y1 ≡[h, o, #0] Y2 →
118                       (Y1 = ⋆ ∧ Y2 = ⋆) ∨
119                       ∃∃I,L1,L2,V1,V2. L1 ≡[h, o, V1] L2 & V1 ≡[h, o] V2 &
120                                        Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
121 #h #o #Y1 #Y2 #H elim (lfxs_inv_zero … H) -H *
122 /3 width=9 by ex4_5_intro, or_introl, or_intror, conj/
123 qed-.
124
125 lemma lfdeq_inv_lref: ∀h,o,Y1,Y2,i. Y1 ≡[h, o, #⫯i] Y2 →
126                       (Y1 = ⋆ ∧ Y2 = ⋆) ∨ 
127                       ∃∃I,L1,L2,V1,V2. L1 ≡[h, o, #i] L2 &
128                                        Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
129 /2 width=1 by lfxs_inv_lref/ qed-.
130
131 (* Basic_2A1: uses: lleq_inv_bind lleq_inv_bind_O *)
132 lemma lfdeq_inv_bind: ∀h,o,p,I,L1,L2,V,T. L1 ≡[h, o, ⓑ{p,I}V.T] L2 →
133                       L1 ≡[h, o, V] L2 ∧ L1.ⓑ{I}V ≡[h, o, T] L2.ⓑ{I}V.
134 /2 width=2 by lfxs_inv_bind/ qed-.
135
136 (* Basic_2A1: uses: lleq_inv_flat *)
137 lemma lfdeq_inv_flat: ∀h,o,I,L1,L2,V,T. L1 ≡[h, o, ⓕ{I}V.T] L2 →
138                       L1 ≡[h, o, V] L2 ∧ L1 ≡[h, o, T] L2.
139 /2 width=2 by lfxs_inv_flat/ qed-.
140
141 (* Advanced inversion lemmas ************************************************)
142
143 lemma lfdeq_inv_zero_pair_sn: ∀h,o,I,Y2,L1,V1. L1.ⓑ{I}V1 ≡[h, o, #0] Y2 →
144                               ∃∃L2,V2. L1 ≡[h, o, V1] L2 & V1 ≡[h, o] V2 & Y2 = L2.ⓑ{I}V2.
145 #h #o #I #Y2 #L1 #V1 #H elim (lfxs_inv_zero_pair_sn … H) -H /2 width=5 by ex3_2_intro/
146 qed-.
147
148 lemma lfdeq_inv_zero_pair_dx: ∀h,o,I,Y1,L2,V2. Y1 ≡[h, o, #0] L2.ⓑ{I}V2 →
149                               ∃∃L1,V1. L1 ≡[h, o, V1] L2 & V1 ≡[h, o] V2 & Y1 = L1.ⓑ{I}V1.
150 #h #o #I #Y1 #L2 #V2 #H elim (lfxs_inv_zero_pair_dx … H) -H
151 #L1 #V1 #HL12 #HV12 #H destruct /2 width=5 by ex3_2_intro/
152 qed-.
153
154 lemma lfdeq_inv_lref_pair_sn: ∀h,o,I,Y2,L1,V1,i. L1.ⓑ{I}V1 ≡[h, o, #⫯i] Y2 →
155                               ∃∃L2,V2. L1 ≡[h, o, #i] L2 & Y2 = L2.ⓑ{I}V2.
156 /2 width=2 by lfxs_inv_lref_pair_sn/ qed-.
157
158 lemma lfdeq_inv_lref_pair_dx: ∀h,o,I,Y1,L2,V2,i. Y1 ≡[h, o, #⫯i] L2.ⓑ{I}V2 →
159                               ∃∃L1,V1. L1 ≡[h, o, #i] L2 & Y1 = L1.ⓑ{I}V1.
160 /2 width=2 by lfxs_inv_lref_pair_dx/ qed-.
161
162 (* Basic forward lemmas *****************************************************)
163
164 (* Basic_2A1: uses: lleq_fwd_bind_sn lleq_fwd_flat_sn *)
165 lemma lfdeq_fwd_pair_sn: ∀h,o,I,L1,L2,V,T. L1 ≡[h, o, ②{I}V.T] L2 → L1 ≡[h, o, V] L2.
166 /2 width=3 by lfxs_fwd_pair_sn/ qed-.
167
168 (* Basic_2A1: uses: lleq_fwd_bind_dx lleq_fwd_bind_O_dx *)
169 lemma lfdeq_fwd_bind_dx: ∀h,o,p,I,L1,L2,V,T.
170                          L1 ≡[h, o, ⓑ{p,I}V.T] L2 → L1.ⓑ{I}V ≡[h, o, T] L2.ⓑ{I}V.
171 /2 width=2 by lfxs_fwd_bind_dx/ qed-.
172
173 (* Basic_2A1: uses: lleq_fwd_flat_dx *)
174 lemma lfdeq_fwd_flat_dx: ∀h,o,I,L1,L2,V,T. L1 ≡[h, o, ⓕ{I}V.T] L2 → L1 ≡[h, o, T] L2.
175 /2 width=3 by lfxs_fwd_flat_dx/ qed-.
176
177 lemma lfdeq_fwd_dx: ∀h,o,I,L1,K2,V2. ∀T:term. L1 ≡[h, o, T] K2.ⓑ{I}V2 →
178                     ∃∃K1,V1. L1 = K1.ⓑ{I}V1.
179 /2 width=5 by lfxs_fwd_dx/ qed-.
180
181 (* Basic_2A1: removed theorems 10:
182               lleq_ind lleq_fwd_lref
183               lleq_fwd_drop_sn lleq_fwd_drop_dx
184               lleq_skip lleq_lref lleq_free
185               lleq_Y lleq_ge_up lleq_ge
186                
187 *)