]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda-delta/Basic-2/substitution/tps_tps.ma
65b1b86d448ad2ea48207969fbf3140d3556eb72
[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_lift.ma".
16
17 (* PARALLEL SUBSTITUTION ON TERMS *******************************************)
18
19 (* Main properties **********************************************************)
20
21 theorem tps_conf: ∀L,T0,T1,d,e. L ⊢ T0 [d, e] ≫ T1 → ∀T2. L ⊢ T0 [d, e] ≫ T2 →
22                   ∃∃T. L ⊢ T1 [d, e] ≫ T & L ⊢ T2 [d, e] ≫ T.
23 #L #T0 #T1 #d #e #H elim H -H L T0 T1 d e
24 [ /2/
25 | #L #K1 #V1 #T1 #i1 #d #e #Hdi1 #Hi1de #HLK1 #HVT1 #T2 #H
26   elim (tps_inv_lref1 … H) -H
27   [ #HX destruct -T2 /4/
28   | * #K2 #V2 #_ #_ #HLK2 #HVT2
29     lapply (drop_mono … HLK1 … HLK2) -HLK1 #H destruct -V1 K1
30     >(lift_mono … HVT1 … HVT2) -HVT1 /2/
31   ]
32 | #L #I #V0 #V1 #T0 #T1 #d #e #_ #_ #IHV01 #IHT01 #X #HX
33   elim (tps_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct -X;
34   elim (IHV01 … HV02) -IHV01 HV02 #V #HV1 #HV2
35   elim (IHT01 … HT02) -IHT01 HT02 #T #HT1 #HT2
36   @ex2_1_intro
37   [2: @tps_bind [4: @(tps_leq_repl … HT1) /2/ |2: skip ]
38   |1: skip
39   |3: @tps_bind [2: @(tps_leq_repl … HT2) /2/ ]
40   ] // (**) (* /5/ is too slow *)
41 | #L #I #V0 #V1 #T0 #T1 #d #e #_ #_ #IHV01 #IHT01 #X #HX
42   elim (tps_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct -X;
43   elim (IHV01 … HV02) -IHV01 HV02;
44   elim (IHT01 … HT02) -IHT01 HT02 /3 width=5/
45 ]
46 qed.
47
48 theorem tps_trans_down: ∀L,T1,T0,d1,e1. L ⊢ T1 [d1, e1] ≫ T0 →
49                         ∀T2,d2,e2. L ⊢ T0 [d2, e2] ≫ T2 → d2 + e2 ≤ d1 →
50                         ∃∃T. L ⊢ T1 [d2, e2] ≫ T & L ⊢ T [d1, e1] ≫ T2.
51 #L #T1 #T0 #d1 #e1 #H elim H -L T1 T0 d1 e1
52 [ /2/
53 | #L #K #V #W #i1 #d1 #e1 #Hdi1 #Hide1 #HLK #HVW #T2 #d2 #e2 #HWT2 #Hde2d1
54   lapply (transitive_le … Hde2d1 Hdi1) -Hde2d1 #Hde2i1
55   lapply (tps_weak … HWT2 0 (i1 + 1) ? ?) -HWT2; normalize /2/ -Hde2i1 #HWT2
56   <(tps_inv_lift1_eq … HWT2 … HVW) -HWT2 /4/
57 | #L #I #V1 #V0 #T1 #T0 #d1 #e1 #_ #_ #IHV10 #IHT10 #X #d2 #e2 #HX #de2d1
58   elim (tps_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct -X;
59   lapply (tps_leq_repl … HT02 (L. 𝕓{I} V1) ?) -HT02 /2/ #HT02
60   elim (IHV10 … HV02 ?) -IHV10 HV02 // #V
61   elim (IHT10 … HT02 ?) -IHT10 HT02 [2: /2/ ] #T #HT1 #HT2
62   lapply (tps_leq_repl … HT2 (L. 𝕓{I} V) ?) -HT2 /3 width=6/
63 | #L #I #V1 #V0 #T1 #T0 #d1 #e1 #_ #_ #IHV10 #IHT10 #X #d2 #e2 #HX #de2d1
64   elim (tps_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct -X;
65   elim (IHV10 … HV02 ?) -IHV10 HV02 //
66   elim (IHT10 … HT02 ?) -IHT10 HT02 // /3 width=6/
67 ]
68 qed.
69 (*
70       Theorem subst0_subst0: (t1,t2,u2:?; j:?) (subst0 j u2 t1 t2) ->
71                              (u1,u:?; i:?) (subst0 i u u1 u2) ->
72                              (EX t | (subst0 j u1 t1 t) & (subst0 (S (plus i j)) u t t2)).
73
74       Theorem subst0_subst0_back: (t1,t2,u2:?; j:?) (subst0 j u2 t1 t2) ->
75                                   (u1,u:?; i:?) (subst0 i u u2 u1) ->
76                                   (EX t | (subst0 j u1 t1 t) & (subst0 (S (plus i j)) u t2 t)).
77
78 *)