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/grammar/term_vector.ma".
16 include "basic_2/relocation/lifts.ma".
18 (* GENERIC RELOCATION FOR TERM VECTORS *************************************)
20 (* Basic_2A1: includes: liftv_nil liftv_cons *)
21 inductive liftsv (f:rtmap): relation (list term) ≝
22 | liftsv_nil : liftsv f (◊) (◊)
23 | liftsv_cons: ∀T1s,T2s,T1,T2.
24 ⬆*[f] T1 ≡ T2 → liftsv f T1s T2s →
25 liftsv f (T1 @ T1s) (T2 @ T2s)
28 interpretation "uniform relocation (vector)"
29 'RLiftStar i T1s T2s = (liftsv (uni i) T1s T2s).
31 interpretation "generic relocation (vector)"
32 'RLiftStar f T1s T2s = (liftsv f T1s T2s).
34 (* Basic inversion lemmas ***************************************************)
36 fact liftsv_inv_nil1_aux: ∀f,X,Y. ⬆*[f] X ≡ Y → X = ◊ → Y = ◊.
38 #T1s #T2s #T1 #T2 #_ #_ #H destruct
41 (* Basic_2A1: includes: liftv_inv_nil1 *)
42 lemma liftsv_inv_nil1: ∀f,Y. ⬆*[f] ◊ ≡ Y → Y = ◊.
43 /2 width=5 by liftsv_inv_nil1_aux/ qed-.
45 fact liftsv_inv_cons1_aux: ∀f:rtmap. ∀X,Y. ⬆*[f] X ≡ Y →
46 ∀T1,T1s. X = T1 @ T1s →
47 ∃∃T2,T2s. ⬆*[f] T1 ≡ T2 & ⬆*[f] T1s ≡ T2s &
50 [ #U1 #U1s #H destruct
51 | #T1s #T2s #T1 #T2 #HT12 #HT12s #U1 #U1s #H destruct /2 width=5 by ex3_2_intro/
55 (* Basic_2A1: includes: liftv_inv_cons1 *)
56 lemma liftsv_inv_cons1: ∀f:rtmap. ∀T1,T1s,Y. ⬆*[f] T1 @ T1s ≡ Y →
57 ∃∃T2,T2s. ⬆*[f] T1 ≡ T2 & ⬆*[f] T1s ≡ T2s &
59 /2 width=3 by liftsv_inv_cons1_aux/ qed-.
61 fact liftsv_inv_nil2_aux: ∀f,X,Y. ⬆*[f] X ≡ Y → Y = ◊ → X = ◊.
63 #T1s #T2s #T1 #T2 #_ #_ #H destruct
66 lemma liftsv_inv_nil2: ∀f,X. ⬆*[f] X ≡ ◊ → X = ◊.
67 /2 width=5 by liftsv_inv_nil2_aux/ qed-.
69 fact liftsv_inv_cons2_aux: ∀f:rtmap. ∀X,Y. ⬆*[f] X ≡ Y →
70 ∀T2,T2s. Y = T2 @ T2s →
71 ∃∃T1,T1s. ⬆*[f] T1 ≡ T2 & ⬆*[f] T1s ≡ T2s &
74 [ #U2 #U2s #H destruct
75 | #T1s #T2s #T1 #T2 #HT12 #HT12s #U2 #U2s #H destruct /2 width=5 by ex3_2_intro/
79 lemma liftsv_inv_cons2: ∀f:rtmap. ∀X,T2,T2s. ⬆*[f] X ≡ T2 @ T2s →
80 ∃∃T1,T1s. ⬆*[f] T1 ≡ T2 & ⬆*[f] T1s ≡ T2s &
82 /2 width=3 by liftsv_inv_cons2_aux/ qed-.
84 (* Basic_1: was: lifts1_flat (left to right) *)
85 lemma lifts_inv_applv1: ∀f:rtmap. ∀V1s,U1,T2. ⬆*[f] Ⓐ V1s.U1 ≡ T2 →
86 ∃∃V2s,U2. ⬆*[f] V1s ≡ V2s & ⬆*[f] U1 ≡ U2 &
89 [ /3 width=5 by ex3_2_intro, liftsv_nil/
90 | #V1 #V1s #IHV1s #T1 #X #H elim (lifts_inv_flat1 … H) -H
91 #V2 #Y #HV12 #HY #H destruct elim (IHV1s … HY) -IHV1s -HY
92 #V2s #T2 #HV12s #HT12 #H destruct /3 width=5 by ex3_2_intro, liftsv_cons/
96 lemma lifts_inv_applv2: ∀f:rtmap. ∀V2s,U2,T1. ⬆*[f] T1 ≡ Ⓐ V2s.U2 →
97 ∃∃V1s,U1. ⬆*[f] V1s ≡ V2s & ⬆*[f] U1 ≡ U2 &
100 [ /3 width=5 by ex3_2_intro, liftsv_nil/
101 | #V2 #V2s #IHV2s #T2 #X #H elim (lifts_inv_flat2 … H) -H
102 #V1 #Y #HV12 #HY #H destruct elim (IHV2s … HY) -IHV2s -HY
103 #V1s #T1 #HV12s #HT12 #H destruct /3 width=5 by ex3_2_intro, liftsv_cons/
107 (* Basic properties *********************************************************)
109 (* Basic_2A1: includes: liftv_total *)
110 lemma liftsv_total: ∀f. ∀T1s:list term. ∃T2s. ⬆*[f] T1s ≡ T2s.
111 #f #T1s elim T1s -T1s
112 [ /2 width=2 by liftsv_nil, ex_intro/
113 | #T1 #T1s * #T2s #HT12s
114 elim (lifts_total T1 f) /3 width=2 by liftsv_cons, ex_intro/
118 (* Basic_1: was: lifts1_flat (right to left) *)
119 lemma lifts_applv: ∀f:rtmap. ∀V1s,V2s. ⬆*[f] V1s ≡ V2s →
120 ∀T1,T2. ⬆*[f] T1 ≡ T2 →
121 ⬆*[f] Ⓐ V1s.T1 ≡ Ⓐ V2s.T2.
122 #f #V1s #V2s #H elim H -V1s -V2s /3 width=1 by lifts_flat/
125 (* Basic_1: removed theorems 2: lifts1_nil lifts1_cons *)