]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/grammar/lenv_px_sn.ma
- new component for restricted computation (delta, zeta and tau only)
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / grammar / lenv_px_sn.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/grammar/lenv_append.ma".
16
17 (* SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS *********)
18
19 inductive lpx_sn (R:lenv→relation term): relation lenv ≝
20 | lpx_sn_stom: lpx_sn R (⋆) (⋆)
21 | lpx_sn_pair: ∀I,K1,K2,V1,V2.
22                lpx_sn R K1 K2 → R K1 V1 V2 →
23                lpx_sn R (K1. ⓑ{I} V1) (K2. ⓑ{I} V2)
24 .
25
26 definition lpx_sn_confluent: predicate (lenv→relation term) ≝ λR.
27                              ∀L0,T0,T1. R L0 T0 T1 → ∀T2. R L0 T0 T2 →
28                              ∀L1. lpx_sn R L0 L1 → ∀L2. lpx_sn R L0 L2 →
29                              ∃∃T. R L1 T1 T & R L2 T2 T.
30
31 definition lpx_sn_transitive: predicate (lenv→relation term) ≝ λR.
32                               ∀L1,T1,T. R L1 T1 T → ∀L2. lpx_sn R L1 L2 →
33                               ∀T2. R L2 T T2 → R L1 T1 T2.
34
35
36 (* Basic inversion lemmas ***************************************************)
37
38 fact lpx_sn_inv_atom1_aux: ∀R,L1,L2. lpx_sn R L1 L2 → L1 = ⋆ → L2 = ⋆.
39 #R #L1 #L2 * -L1 -L2
40 [ //
41 | #I #K1 #K2 #V1 #V2 #_ #_ #H destruct
42 ]
43 qed-.
44
45 lemma lpx_sn_inv_atom1: ∀R,L2. lpx_sn R (⋆) L2 → L2 = ⋆.
46 /2 width=4 by lpx_sn_inv_atom1_aux/ qed-.
47
48 fact lpx_sn_inv_pair1_aux: ∀R,L1,L2. lpx_sn R L1 L2 → ∀I,K1,V1. L1 = K1. ⓑ{I} V1 →
49                            ∃∃K2,V2. lpx_sn R K1 K2 & R K1 V1 V2 & L2 = K2. ⓑ{I} V2.
50 #R #L1 #L2 * -L1 -L2
51 [ #J #K1 #V1 #H destruct
52 | #I #K1 #K2 #V1 #V2 #HK12 #HV12 #J #L #W #H destruct /2 width=5/
53 ]
54 qed-.
55
56 lemma lpx_sn_inv_pair1: ∀R,I,K1,V1,L2. lpx_sn R (K1. ⓑ{I} V1) L2 →
57                         ∃∃K2,V2. lpx_sn R K1 K2 & R K1 V1 V2 & L2 = K2. ⓑ{I} V2.
58 /2 width=3 by lpx_sn_inv_pair1_aux/ qed-.
59
60 fact lpx_sn_inv_atom2_aux: ∀R,L1,L2. lpx_sn R L1 L2 → L2 = ⋆ → L1 = ⋆.
61 #R #L1 #L2 * -L1 -L2
62 [ //
63 | #I #K1 #K2 #V1 #V2 #_ #_ #H destruct
64 ]
65 qed-.
66
67 lemma lpx_sn_inv_atom2: ∀R,L1. lpx_sn R L1 (⋆) → L1 = ⋆.
68 /2 width=4 by lpx_sn_inv_atom2_aux/ qed-.
69
70 fact lpx_sn_inv_pair2_aux: ∀R,L1,L2. lpx_sn R L1 L2 → ∀I,K2,V2. L2 = K2. ⓑ{I} V2 →
71                            ∃∃K1,V1. lpx_sn R K1 K2 & R K1 V1 V2 & L1 = K1. ⓑ{I} V1.
72 #R #L1 #L2 * -L1 -L2
73 [ #J #K2 #V2 #H destruct
74 | #I #K1 #K2 #V1 #V2 #HK12 #HV12 #J #K #W #H destruct /2 width=5/
75 ]
76 qed-.
77
78 lemma lpx_sn_inv_pair2: ∀R,I,L1,K2,V2. lpx_sn R L1 (K2. ⓑ{I} V2) →
79                         ∃∃K1,V1. lpx_sn R K1 K2 & R K1 V1 V2 & L1 = K1. ⓑ{I} V1.
80 /2 width=3 by lpx_sn_inv_pair2_aux/ qed-.
81
82 (* Basic forward lemmas *****************************************************)
83
84 lemma lpx_sn_fwd_length: ∀R,L1,L2. lpx_sn R L1 L2 → |L1| = |L2|.
85 #R #L1 #L2 #H elim H -L1 -L2 normalize //
86 qed-.
87
88 (* Basic properties *********************************************************)
89
90 lemma lpx_sn_refl: ∀R. (∀L. reflexive ? (R L)) → reflexive … (lpx_sn R).
91 #R #HR #L elim L -L // /2 width=1/
92 qed-.
93
94 lemma lpx_sn_append: ∀R. l_appendable_sn R →
95                      ∀K1,K2. lpx_sn R K1 K2 → ∀L1,L2. lpx_sn R L1 L2 →
96                      lpx_sn R (L1 @@ K1) (L2 @@ K2).
97 #R #HR #K1 #K2 #H elim H -K1 -K2 // /3 width=1/
98 qed-.
99
100 lemma lpx_sn_trans: ∀R. lpx_sn_transitive R → Transitive … (lpx_sn R).
101 #R #HR #L1 #L #H elim H -L1 -L //
102 #I #L1 #L #V1 #V #HL1 #HV1 #IHL1 #X #H
103 elim (lpx_sn_inv_pair1 … H) -H #L2 #V2 #HL2 #HV2 #H destruct /3 width=5/
104 qed-.
105
106 lemma lpx_sn_conf: ∀R. lpx_sn_confluent R → confluent … (lpx_sn R).
107 #R #HR #L0 @(f_ind … length … L0) -L0 #n #IH *
108 [ #_ #X1 #H1 #X2 #H2 -n
109   >(lpx_sn_inv_atom1 … H1) -X1
110   >(lpx_sn_inv_atom1 … H2) -X2 /2 width=3/
111 | #L0 #I #V0 #Hn #X1 #H1 #X2 #H2 destruct
112   elim (lpx_sn_inv_pair1 … H1) -H1 #L1 #V1 #HL01 #HV01 #H destruct
113   elim (lpx_sn_inv_pair1 … H2) -H2 #L2 #V2 #HL02 #HV02 #H destruct
114   elim (IH … HL01 … HL02) -IH normalize // #L #HL1 #HL2
115   elim (HR … HV01 … HV02 … HL01 … HL02) -L0 -V0 /3 width=5/
116 ]
117 qed-.