]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda-delta/Basic-2/substitution/tps_tps.ma
we now use non-telescopic substitution in parallel reduction, rather
[helm.git] / matita / matita / contribs / lambda-delta / Basic-2 / substitution / tps_tps.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/tps_split.ma".
16
17 (* PARTIAL SUBSTITUTION ON TERMS ********************************************)
18
19 (* Main properties **********************************************************)
20 (*
21 theorem tps_trans: ∀L,T1,T,d,e. L ⊢ T1 [d, e] ≫ T → ∀T2. L ⊢ T [d, e] ≫ T2 →
22                    L ⊢ T1 [d, e] ≫ T2.
23 #L #T1 #T #d #e #H elim H -L T1 T d e
24 [ //
25 | //
26 | #L #K #V #V1 #V2 #i #d #e #Hdi #Hide #HLK #_ #HV12 #IHV12 #T2 #HVT2
27   lapply (drop_fwd_drop2 … HLK) #H
28   elim (tps_inv_lift1_up … HVT2 … H … HV12 ? ? ?) -HVT2 H HV12 // normalize [2: /2/ ] #V #HV1 #HVT2
29   @tps_subst [4,5,6,8: // |1,2,3: skip | /2/ ]
30 | #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #X #HX
31   elim (tps_inv_bind1 … HX) -HX #V #T #HV2 #HT2 #HX destruct -X;
32   @tps_bind /2/ @IHT12 @(tps_leq_repl … HT2) /2/
33 | #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #X #HX
34   elim (tps_inv_flat1 … HX) -HX #V #T #HV2 #HT2 #HX destruct -X /3/
35 ]
36 qed.
37 *)
38
39 axiom tps_conf_subst_subst_lt: ∀L,K1,V1,T1,i1,d,e,T2,K2,V2,i2.
40    ↓[O, i1] L ≡ K1. 𝕓{Abbr} V1 → ↓[O, i2] L≡ K2. 𝕓{Abbr} V2 →
41    ↑[O, i1 + 1] V1 ≡ T1 → ↑[O, i2 + 1] V2 ≡ T2 → 
42    d ≤ i1 → i1 < d + e → d ≤ i2 → i2 < d + e → i1 < i2 →
43    ∃∃T. L ⊢ T1 [d, e] ≫ T & L ⊢ T2 [d, e] ≫ T.  
44 (*
45 #L #K1 #V1 #T1 #i1 #d #e #T2 #K2 #V2 #i2
46 #HLK1 #HLK2 #HVW1 #HVW2 #HWT1 #HWT2 #Hdi1 #Hi1de #Hdi2 #Hi2de #Hi12
47 *)
48
49 theorem tps_conf: ∀L,T0,T1,d,e. L ⊢ T0 [d, e] ≫ T1 → ∀T2. L ⊢ T0 [d, e] ≫ T2 →
50                   ∃∃T. L ⊢ T1 [d, e] ≫ T & L ⊢ T2 [d, e] ≫ T.
51 #L #T0 #T1 #d #e #H elim H -H L T0 T1 d e
52 [ /2/
53 | /2/
54 | #L #K1 #V1 #T1 #i1 #d #e #Hdi1 #Hi1de #HLK1 #HVT1 #T2 #H
55   elim (tps_inv_lref1 … H) -H
56   [ #HX destruct -T2 /4/
57   | * #K2 #V2 #i2 #Hdi2 #Hi2de #HLK2 #HVT2
58     elim (lt_or_eq_or_gt i1 i2) #Hi12
59     [ @tps_conf_subst_subst_lt /width=15/
60     | -Hdi2 Hi2de; destruct -i2;
61       lapply (drop_mono … HLK1 … HLK2) -HLK1 #H destruct -V1 K1
62       >(lift_mono … HVT1 … HVT2) -HVT1 /2/
63     | @ex2_1_comm @tps_conf_subst_subst_lt /width=15/
64     ]
65   ]
66 | #L #I #V0 #V1 #T0 #T1 #d #e #_ #_ #IHV01 #IHT01 #X #HX
67   elim (tps_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct -X; 
68   elim (IHV01 … HV02) -IHV01 HV02 #V #HV1 #HV2
69   elim (IHT01 … HT02) -IHT01 HT02 #T #HT1 #HT2 
70   @ex2_1_intro
71   [2: @tps_bind [4: @(tps_leq_repl … HT1) /2/ |2: skip ]
72   |1: skip
73   |3: @tps_bind [2: @(tps_leq_repl … HT2) /2/ ]
74   ] // (**) (* /5/ is too slow *)
75 | #L #I #V0 #V1 #T0 #T1 #d #e #_ #_ #IHV01 #IHT01 #X #HX
76   elim (tps_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct -X; 
77   elim (IHV01 … HV02) -IHV01 HV02;
78   elim (IHT01 … HT02) -IHT01 HT02 /3 width=5/
79 ]
80 qed.
81
82 (*
83       Theorem subst0_subst0: (t1,t2,u2:?; j:?) (subst0 j u2 t1 t2) ->
84                              (u1,u:?; i:?) (subst0 i u u1 u2) ->
85                              (EX t | (subst0 j u1 t1 t) & (subst0 (S (plus i j)) u t t2)).
86
87       Theorem subst0_subst0_back: (t1,t2,u2:?; j:?) (subst0 j u2 t1 t2) ->
88                                   (u1,u:?; i:?) (subst0 i u u2 u1) ->
89                                   (EX t | (subst0 j u1 t1 t) & (subst0 (S (plus i j)) u t2 t)).
90
91 *)