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_2A/substitution/drop.ma".
16 include "basic_2A/substitution/lpx_sn.ma".
18 (* SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS *********)
20 (* Note: 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 →
28 (* Basic forward lemmas ******************************************************)
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 //
34 (* Basic inversion lemmas ***************************************************)
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/
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
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/
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/
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
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/
70 (* Basic properties *********************************************************)
72 lemma lpx_sn_alt_atom: ∀R. lpx_sn_alt R (⋆) (⋆).
74 #I1 #I2 #K1 #K2 #V1 #V2 #i #HLK1 elim (drop_inv_atom1 … HLK1) -HLK1
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
85 lapply (drop_inv_O2 … HLK1) -HLK1 #H destruct
86 lapply (drop_inv_O2 … HLK2) -HLK2 #H destruct
88 | -HL12 -HV12 /3 width=6 by drop_inv_drop1/
92 (* Main properties **********************************************************)
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/
99 (* Main inversion lemmas ****************************************************)
101 theorem lpx_sn_alt_inv_lpx_sn: ∀R,L1,L2. lpx_sn_alt R L1 L2 → lpx_sn R L1 L2.
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/
109 (* alternative definition of lpx_sn *****************************************)
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 →
116 /4 width=4 by lpx_sn_alt_inv_lpx_sn, conj/ qed.
118 lemma lpx_sn_inv_alt: ∀R,L1,L2. lpx_sn R 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/