]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/relocation/lpx_sn_alt.ma
some resuls on pointwise extensions (all of them are now in the
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / relocation / lpx_sn_alt.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/relocation/ldrop.ma".
16 include "basic_2/relocation/lpx_sn.ma".
17
18 (* SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS *********)
19
20 (* alternative definition of lpx_sn_alt *)
21 inductive lpx_sn_alt (R:relation3 lenv term term): relation lenv ≝
22 | lpx_sn_alt_intro: ∀L1,L2.
23                     (∀I1,I2,K1,K2,V1,V2,i.
24                        ⇩[i] L1 ≡ K1.ⓑ{I1}V1 → ⇩[i] L2 ≡ K2.ⓑ{I2}V2 → I1 = I2 ∧ R K1 V1 V2
25                     ) →
26                     (∀I1,I2,K1,K2,V1,V2,i.
27                        ⇩[i] L1 ≡ K1.ⓑ{I1}V1 → ⇩[i] L2 ≡ K2.ⓑ{I2}V2 → lpx_sn_alt R K1 K2
28                     ) → |L1| = |L2| → lpx_sn_alt R L1 L2
29 .
30
31 (* Basic forward lemmas ******************************************************)
32
33 lemma lpx_sn_alt_fwd_length: ∀R,L1,L2. lpx_sn_alt R L1 L2 → |L1| = |L2|.
34 #R #L1 #L2 * -L1 -L2 //
35 qed-.
36
37 (* Basic inversion lemmas ***************************************************)
38
39 lemma lpx_sn_alt_inv_gen: ∀R,L1,L2. lpx_sn_alt R L1 L2 →
40                           |L1| = |L2| ∧
41                           ∀I1,I2,K1,K2,V1,V2,i.
42                           ⇩[i] L1 ≡ K1.ⓑ{I1}V1 → ⇩[i] L2 ≡ K2.ⓑ{I2}V2 →
43                           ∧∧ I1 = I2 & R K1 V1 V2 & lpx_sn_alt R K1 K2.
44 #R #L1 #L2 * -L1 -L2
45 #L1 #L2 #IH1 #IH2 #HL12 @conj //
46 #I1 #I2 #K1 #K2 #HLK1 #HLK2 #i #HLK1 #HLK2
47 elim (IH1 … HLK1 HLK2) -IH1 /3 width=7 by and3_intro/
48 qed-.
49
50 lemma lpx_sn_alt_inv_atom1: ∀R,L2. lpx_sn_alt R (⋆) L2 → L2 = ⋆.
51 #R #L2 #H lapply (lpx_sn_alt_fwd_length … H) -H
52 normalize /2 width=1 by length_inv_zero_sn/
53 qed-.
54
55 lemma lpx_sn_alt_inv_pair1: ∀R,I,L2,K1,V1. lpx_sn_alt R (K1.ⓑ{I}V1) L2 →
56                             ∃∃K2,V2. lpx_sn_alt R K1 K2 & R K1 V1 V2 & L2 = K2.ⓑ{I}V2.
57 #R #I1 #L2 #K1 #V1 #H elim (lpx_sn_alt_inv_gen … H) -H
58 #H #IH elim (length_inv_pos_sn … H) -H
59 #I2 #K2 #V2 #HK12 #H destruct
60 elim (IH I1 I2 K1 K2 V1 V2 0) -IH /2 width=5 by ex3_2_intro/
61 qed-.
62
63 lemma lpx_sn_alt_inv_atom2: ∀R,L1. lpx_sn_alt R L1 (⋆) → L1 = ⋆.
64 #R #L1 #H lapply (lpx_sn_alt_fwd_length … H) -H
65 normalize /2 width=1 by length_inv_zero_dx/
66 qed-.
67
68 lemma lpx_sn_alt_inv_pair2: ∀R,I,L1,K2,V2. lpx_sn_alt R L1 (K2.ⓑ{I}V2) →
69                             ∃∃K1,V1. lpx_sn_alt R K1 K2 & R K1 V1 V2 & L1 = K1.ⓑ{I}V1.
70 #R #I2 #L1 #K2 #V2 #H elim (lpx_sn_alt_inv_gen … H) -H
71 #H #IH elim (length_inv_pos_dx … H) -H
72 #I1 #K1 #V1 #HK12 #H destruct
73 elim (IH I1 I2 K1 K2 V1 V2 0) -IH /2 width=5 by ex3_2_intro/
74 qed-.
75
76 (* Basic properties *********************************************************)
77
78 lemma lpx_sn_alt_intro_alt: ∀R,L1,L2. |L1| = |L2| →
79                             (∀I1,I2,K1,K2,V1,V2,i.
80                                ⇩[i] L1 ≡ K1.ⓑ{I1}V1 → ⇩[i] L2 ≡ K2.ⓑ{I2}V2 →
81                                ∧∧ I1 = I2 & R K1 V1 V2 & lpx_sn_alt R K1 K2
82                             ) → lpx_sn_alt R L1 L2.
83 #R #L1 #L2 #HL12 #IH @lpx_sn_alt_intro // -HL12
84 #I1 #I2 #K1 #K2 #V1 #V2 #i #HLK1 #HLK2
85 elim (IH … HLK1 HLK2) -IH -HLK1 -HLK2 /2 width=1 by conj/
86 qed.
87
88 lemma lpx_sn_alt_atom: ∀R. lpx_sn_alt R (⋆) (⋆).
89 #R @lpx_sn_alt_intro_alt //
90 #I1 #I2 #K1 #K2 #V1 #V2 #i #HLK1 elim (ldrop_inv_atom1 … HLK1) -HLK1
91 #H destruct
92 qed.
93
94 lemma lpx_sn_alt_pair: ∀R,I,L1,L2,V1,V2.
95                        lpx_sn_alt R L1 L2 → R L1 V1 V2 →
96                        lpx_sn_alt R (L1.ⓑ{I}V1) (L2.ⓑ{I}V2).
97 #R #I #L1 #L2 #V1 #V2 #H #HV12 elim (lpx_sn_alt_inv_gen … H) -H
98 #HL12 #IH @lpx_sn_alt_intro_alt normalize //
99 #I1 #I2 #K1 #K2 #W1 #W2 #i @(nat_ind_plus … i) -i
100 [ #HLK1 #HLK2
101   lapply (ldrop_inv_O2 … HLK1) -HLK1 #H destruct
102   lapply (ldrop_inv_O2 … HLK2) -HLK2 #H destruct
103   /4 width=3 by lpx_sn_alt_intro_alt, and3_intro/
104 | -HL12 -HV12 /3 width=5 by ldrop_inv_drop1/
105 ]
106 qed.
107
108 (* Main properties **********************************************************)
109
110 theorem lpx_sn_lpx_sn_alt: ∀R,L1,L2. lpx_sn R L1 L2 → lpx_sn_alt R L1 L2.
111 #R #L1 #L2 #H elim H -L1 -L2
112 /2 width=1 by lpx_sn_alt_atom, lpx_sn_alt_pair/
113 qed.
114
115 (* Main inversion lemmas ****************************************************)
116
117 theorem lpx_sn_alt_inv_lpx_sn: ∀R,L1,L2. lpx_sn_alt R L1 L2 → lpx_sn R L1 L2.
118 #R #L1 elim L1 -L1
119 [ #L2 #H lapply (lpx_sn_alt_inv_atom1 … H) -H //
120 | #L1 #I #V1 #IH #X #H elim (lpx_sn_alt_inv_pair1 … H) -H
121   #L2 #V2 #HL12 #HV12 #H destruct /3 width=1 by lpx_sn_pair/
122 ]
123 qed-.
124
125 (* Advanced properties ******************************************************)
126
127 lemma lpx_sn_intro_alt: ∀R,L1,L2. |L1| = |L2| →
128                         (∀I1,I2,K1,K2,V1,V2,i.
129                            ⇩[i] L1 ≡ K1.ⓑ{I1}V1 → ⇩[i] L2 ≡ K2.ⓑ{I2}V2 →
130                            ∧∧ I1 = I2 & R K1 V1 V2 & lpx_sn R K1 K2
131                         ) → lpx_sn R L1 L2.
132 #R #L1 #L2 #HL12 #IH @lpx_sn_alt_inv_lpx_sn
133 @lpx_sn_alt_intro_alt // -HL12
134 #I1 #I2 #K1 #K2 #V1 #V2 #i #HLK1 #HLK2
135 elim (IH … HLK1 HLK2) -IH -HLK1 -HLK2 /3 width=1 by lpx_sn_lpx_sn_alt, and3_intro/
136 qed.
137
138 (* Advanced inversion lemmas ************************************************)
139
140 lemma lpx_sn_inv_alt: ∀R,L1,L2. lpx_sn R L1 L2 →
141                       |L1| = |L2| ∧
142                       ∀I1,I2,K1,K2,V1,V2,i.
143                       ⇩[i] L1 ≡ K1.ⓑ{I1}V1 → ⇩[i] L2 ≡ K2.ⓑ{I2}V2 →
144                       ∧∧ I1 = I2 & R K1 V1 V2 & lpx_sn R K1 K2.
145 #R #L1 #L2 #H lapply (lpx_sn_lpx_sn_alt … H) -H
146 #H elim (lpx_sn_alt_inv_gen … H) -H
147 #HL12 #IH @conj //
148 #I1 #I2 #K1 #K2 #V1 #V2 #i #HLK1 #HLK2
149 elim (IH … HLK1 HLK2) -IH -HLK1 -HLK2 /3 width=1 by lpx_sn_alt_inv_lpx_sn, and3_intro/
150 qed-.