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_2/substitution/ltps.ma".
16 include "Basic_2/unfold/tpss.ma".
18 (* PARTIAL UNFOLD ON LOCAL ENVIRONMENTS *************************************)
20 definition ltpss: nat → nat → relation lenv ≝
21 λd,e. TC … (ltps d e).
23 interpretation "partial unfold (local environment)"
24 'PSubstStar L1 d e L2 = (ltpss d e L1 L2).
26 (* Basic eliminators ********************************************************)
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) //
34 (* Basic properties *********************************************************)
36 lemma ltpss_strap: ∀L1,L,L2,d,e.
37 L1 [d, e] ▶ L → L [d, e] ▶* L2 → L1 [d, e] ▶* L2.
40 lemma ltpss_refl: ∀L,d,e. L [d, e] ▶* L.
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 //
46 >(ltps_fwd_length … HL2) /3 width=5/
49 (* Basic forward lemmas *****************************************************)
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/
57 (* Basic inversion lemmas ***************************************************)
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 //
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 //
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/
76 lemma ltpss_inv_atom2: ∀d,e,L1. L1 [d, e] ▶* ⋆ → L1 = ⋆.
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 &
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)
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 &
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 &
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/
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 &