]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/basic_2/unfold/ltpss.ma
We are decapitalizing the contributions' names ...
[helm.git] / matita / matita / contribs / lambda_delta / basic_2 / unfold / ltpss.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/substitution/ltps.ma".
16 include "Basic_2/unfold/tpss.ma".
17
18 (* PARTIAL UNFOLD ON LOCAL ENVIRONMENTS *************************************)
19
20 definition ltpss: nat → nat → relation lenv ≝
21                   λd,e. TC … (ltps d e).
22
23 interpretation "partial unfold (local environment)"
24    'PSubstStar L1 d e L2 = (ltpss d e L1 L2).
25
26 (* Basic eliminators ********************************************************)
27
28 lemma ltpss_ind: ∀d,e,L1. ∀R:predicate lenv. R L1 →
29                  (∀L,L2. L1 [d, e] ▶* L → L [d, e] ▶ L2 → R L → R L2) →
30                  ∀L2. L1 [d, e] ▶* L2 → R L2.
31 #d #e #L1 #R #HL1 #IHL1 #L2 #HL12 @(TC_star_ind … HL1 IHL1 … HL12) //
32 qed-.
33
34 (* Basic properties *********************************************************)
35
36 lemma ltpss_strap: ∀L1,L,L2,d,e.
37                    L1 [d, e] ▶ L → L [d, e] ▶* L2 → L1 [d, e] ▶* L2. 
38 /2 width=3/ qed.
39
40 lemma ltpss_refl: ∀L,d,e. L [d, e] ▶* L.
41 /2 width=1/ qed.
42
43 lemma ltpss_weak_all: ∀L1,L2,d,e. L1 [d, e] ▶* L2 → L1 [0, |L2|] ▶* L2.
44 #L1 #L2 #d #e #H @(ltpss_ind … H) -L2 //
45 #L #L2 #_ #HL2
46 >(ltps_fwd_length … HL2) /3 width=5/
47 qed.
48
49 (* Basic forward lemmas *****************************************************)
50
51 lemma ltpss_fwd_length: ∀L1,L2,d,e. L1 [d, e] ▶* L2 → |L1| = |L2|.
52 #L1 #L2 #d #e #H @(ltpss_ind … H) -L2 //
53 #L #L2 #_ #HL2 #IHL12 >IHL12 -IHL12
54 /2 width=3 by ltps_fwd_length/
55 qed-.
56
57 (* Basic inversion lemmas ***************************************************)
58
59 lemma ltpss_inv_refl_O2: ∀d,L1,L2. L1 [d, 0] ▶* L2 → L1 = L2.
60 #d #L1 #L2 #H @(ltpss_ind … H) -L2 //
61 #L #L2 #_ #HL2 #IHL <(ltps_inv_refl_O2 … HL2) -HL2 //
62 qed-.
63
64 lemma ltpss_inv_atom1: ∀d,e,L2. ⋆ [d, e] ▶* L2 → L2 = ⋆.
65 #d #e #L2 #H @(ltpss_ind … H) -L2 //
66 #L #L2 #_ #HL2 #IHL destruct
67 >(ltps_inv_atom1 … HL2) -HL2 //
68 qed-.
69
70 fact ltpss_inv_atom2_aux: ∀d,e,L1,L2. L1 [d, e] ▶* L2 → L2 = ⋆ → L1 = ⋆.
71 #d #e #L1 #L2 #H @(ltpss_ind … H) -L2 //
72 #L2 #L #_ #HL2 #IHL2 #H destruct
73 lapply (ltps_inv_atom2 … HL2) -HL2 /2 width=1/
74 qed.
75
76 lemma ltpss_inv_atom2: ∀d,e,L1. L1 [d, e] ▶* ⋆ → L1 = ⋆.
77 /2 width=5/ qed-.
78 (*
79 fact ltps_inv_tps22_aux: ∀d,e,L1,L2. L1 [d, e] ▶ L2 → d = 0 → 0 < e →
80                          ∀K2,I,V2. L2 = K2. ⓑ{I} V2 →
81                          ∃∃K1,V1. K1 [0, e - 1] ▶ K2 &
82                                   K2 ⊢ V1 [0, e - 1] ▶ V2 &
83                                   L1 = K1. ⓑ{I} V1.
84 #d #e #L1 #L2 * -d e L1 L2
85 [ #d #e #_ #_ #K1 #I #V1 #H destruct
86 | #L1 #I #V #_ #H elim (lt_refl_false … H)
87 | #L1 #L2 #I #V1 #V2 #e #HL12 #HV12 #_ #_ #K2 #J #W2 #H destruct /2 width=5/
88 | #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H elim (plus_S_eq_O_false … H)
89 ]
90 qed.
91
92 lemma ltps_inv_tps22: ∀e,L1,K2,I,V2. L1 [0, e] ▶ K2. ⓑ{I} V2 → 0 < e →
93                       ∃∃K1,V1. K1 [0, e - 1] ▶ K2 & K2 ⊢ V1 [0, e - 1] ▶ V2 &
94                                L1 = K1. ⓑ{I} V1.
95 /2 width=5/ qed.
96
97 fact ltps_inv_tps12_aux: ∀d,e,L1,L2. L1 [d, e] ▶ L2 → 0 < d →
98                          ∀I,K2,V2. L2 = K2. ⓑ{I} V2 →
99                          ∃∃K1,V1. K1 [d - 1, e] ▶ K2 &
100                                   K2 ⊢ V1 [d - 1, e] ▶ V2 &
101                                   L1 = K1. ⓑ{I} V1.
102 #d #e #L1 #L2 * -d e L1 L2
103 [ #d #e #_ #I #K2 #V2 #H destruct
104 | #L #I #V #H elim (lt_refl_false … H)
105 | #L1 #L2 #I #V1 #V2 #e #_ #_ #H elim (lt_refl_false … H)
106 | #L1 #L2 #I #V1 #V2 #d #e #HL12 #HV12 #_ #J #K2 #W2 #H destruct /2 width=5/
107 ]
108 qed.
109
110 lemma ltps_inv_tps12: ∀L1,K2,I,V2,d,e. L1 [d, e] ▶ K2. ⓑ{I} V2 → 0 < d →
111                       ∃∃K1,V1. K1 [d - 1, e] ▶ K2 &
112                                   K2 ⊢ V1 [d - 1, e] ▶ V2 &
113                                   L1 = K1. ⓑ{I} V1.
114 /2 width=1/ qed.
115 *)