]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/substitution/lpx_sn_alt.ma
update in lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / substitution / 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_2A/substitution/drop.ma".
16 include "basic_2A/substitution/lpx_sn.ma".
17
18 (* SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS *********)
19
20 (* alternative definition of lpx_sn *)
21 definition lpx_sn_alt: relation3 lenv term term → relation lenv ≝
22                        λR,L1,L2. |L1| = |L2| ∧
23                        (∀I1,I2,K1,K2,V1,V2,i.
24                           ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
25                           I1 = I2 ∧ R K1 V1 V2
26                        ).
27
28 (* Basic forward lemmas ******************************************************)
29
30 lemma lpx_sn_alt_fwd_length: ∀R,L1,L2. lpx_sn_alt R L1 L2 → |L1| = |L2|.
31 #R #L1 #L2 #H elim H //
32 qed-.
33
34 (* Basic inversion lemmas ***************************************************)
35
36 lemma lpx_sn_alt_inv_atom1: ∀R,L2. lpx_sn_alt R (⋆) L2 → L2 = ⋆.
37 #R #L2 #H lapply (lpx_sn_alt_fwd_length … H) -H
38 normalize /2 width=1 by length_inv_zero_sn/
39 qed-.
40
41 lemma lpx_sn_alt_inv_pair1: ∀R,I,L2,K1,V1. lpx_sn_alt R (K1.ⓑ{I}V1) L2 →
42                             ∃∃K2,V2. lpx_sn_alt R K1 K2 & R K1 V1 V2 & L2 = K2.ⓑ{I}V2.
43 #R #I1 #L2 #K1 #V1 #H elim H -H
44 #H #IH elim (length_inv_pos_sn … H) -H
45 #I2 #K2 #V2 #HK12 #H destruct
46 elim (IH I1 I2 K1 K2 V1 V2 0) //
47 #H #HV12 destruct @(ex3_2_intro … K2 V2) // -HV12
48 @conj // -HK12
49 #J1 #J2 #L1 #L2 #W1 #W2 #i #HKL1 #HKL2 elim (IH J1 J2 L1 L2 W1 W2 (i+1)) -IH
50 /2 width=1 by drop_drop, conj/
51 qed-.
52
53 lemma lpx_sn_alt_inv_atom2: ∀R,L1. lpx_sn_alt R L1 (⋆) → L1 = ⋆.
54 #R #L1 #H lapply (lpx_sn_alt_fwd_length … H) -H
55 normalize /2 width=1 by length_inv_zero_dx/
56 qed-.
57
58 lemma lpx_sn_alt_inv_pair2: ∀R,I,L1,K2,V2. lpx_sn_alt R L1 (K2.ⓑ{I}V2) →
59                             ∃∃K1,V1. lpx_sn_alt R K1 K2 & R K1 V1 V2 & L1 = K1.ⓑ{I}V1.
60 #R #I2 #L1 #K2 #V2 #H elim H -H
61 #H #IH elim (length_inv_pos_dx … H) -H
62 #I1 #K1 #V1 #HK12 #H destruct
63 elim (IH I1 I2 K1 K2 V1 V2 0) //
64 #H #HV12 destruct @(ex3_2_intro … K1 V1) // -HV12
65 @conj // -HK12
66 #J1 #J2 #L1 #L2 #W1 #W2 #i #HKL1 #HKL2 elim (IH J1 J2 L1 L2 W1 W2 (i+1)) -IH
67 /2 width=1 by drop_drop, conj/
68 qed-.
69
70 (* Basic properties *********************************************************)
71
72 lemma lpx_sn_alt_atom: ∀R. lpx_sn_alt R (⋆) (⋆).
73 #R @conj //
74 #I1 #I2 #K1 #K2 #V1 #V2 #i #HLK1 elim (drop_inv_atom1 … HLK1) -HLK1
75 #H destruct
76 qed.
77
78 lemma lpx_sn_alt_pair: ∀R,I,L1,L2,V1,V2.
79                        lpx_sn_alt R L1 L2 → R L1 V1 V2 →
80                        lpx_sn_alt R (L1.ⓑ{I}V1) (L2.ⓑ{I}V2).
81 #R #I #L1 #L2 #V1 #V2 #H #HV12 elim H -H
82 #HL12 #IH @conj normalize //
83 #I1 #I2 #K1 #K2 #W1 #W2 #i @(nat_ind_plus … i) -i
84 [ #HLK1 #HLK2
85   lapply (drop_inv_O2 … HLK1) -HLK1 #H destruct
86   lapply (drop_inv_O2 … HLK2) -HLK2 #H destruct
87   /2 width=1 by conj/
88 | -HL12 -HV12 /3 width=6 by drop_inv_drop1/
89 ]
90 qed.
91
92 (* Main properties **********************************************************)
93
94 theorem lpx_sn_lpx_sn_alt: ∀R,L1,L2. lpx_sn R L1 L2 → lpx_sn_alt R L1 L2.
95 #R #L1 #L2 #H elim H -L1 -L2
96 /2 width=1 by lpx_sn_alt_atom, lpx_sn_alt_pair/
97 qed.
98
99 (* Main inversion lemmas ****************************************************)
100
101 theorem lpx_sn_alt_inv_lpx_sn: ∀R,L1,L2. lpx_sn_alt R L1 L2 → lpx_sn R L1 L2.
102 #R #L1 elim L1 -L1
103 [ #L2 #H lapply (lpx_sn_alt_inv_atom1 … H) -H //
104 | #L1 #I #V1 #IH #X #H elim (lpx_sn_alt_inv_pair1 … H) -H
105   #L2 #V2 #HL12 #HV12 #H destruct /3 width=1 by lpx_sn_pair/
106 ]
107 qed-.
108
109 (* alternative definition of lpx_sn *****************************************)
110
111 lemma lpx_sn_intro_alt: ∀R,L1,L2. |L1| = |L2| →
112                         (∀I1,I2,K1,K2,V1,V2,i.
113                            ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
114                            I1 = I2 ∧ R K1 V1 V2
115                         ) → lpx_sn R L1 L2.
116 /4 width=4 by lpx_sn_alt_inv_lpx_sn, conj/ qed.
117
118 lemma lpx_sn_inv_alt: ∀R,L1,L2. lpx_sn R L1 L2 →
119                       |L1| = |L2| ∧
120                       ∀I1,I2,K1,K2,V1,V2,i.
121                       ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
122                       I1 = I2 ∧ R K1 V1 V2.
123 #R #L1 #L2 #H lapply (lpx_sn_lpx_sn_alt … H) -H
124 #H elim H -H /3 width=4 by conj/
125 qed-.