]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/substitution/cpy_cpy.ma
parked material ...
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / substitution / cpy_cpy.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/cpy_lift.ma".
16
17 (* CONTEXT-SENSITIVE EXTENDED ORDINARY SUBSTITUTION FOR TERMS ***************)
18
19 (* Main properties **********************************************************)
20
21 (* Basic_1: was: subst1_confluence_eq *)
22 theorem cpy_conf_eq: ∀G,L,T0,T1,l1,m1. ⦃G, L⦄ ⊢ T0 ▶[l1, m1] T1 →
23                      ∀T2,l2,m2. ⦃G, L⦄ ⊢ T0 ▶[l2, m2] T2 →
24                      ∃∃T. ⦃G, L⦄ ⊢ T1 ▶[l2, m2] T & ⦃G, L⦄ ⊢ T2 ▶[l1, m1] T.
25 #G #L #T0 #T1 #l1 #m1 #H elim H -G -L -T0 -T1 -l1 -m1
26 [ /2 width=3 by ex2_intro/
27 | #I1 #G #L #K1 #V1 #T1 #i0 #l1 #m1 #Hl1 #Hlm1 #HLK1 #HVT1 #T2 #l2 #m2 #H
28   elim (cpy_inv_lref1 … H) -H
29   [ #HX destruct /3 width=7 by cpy_subst, ex2_intro/
30   | -Hl1 -Hlm1 * #I2 #K2 #V2 #_ #_ #HLK2 #HVT2
31     lapply (drop_mono … HLK1 … HLK2) -HLK1 -HLK2 #H destruct
32     >(lift_mono … HVT1 … HVT2) -HVT1 -HVT2 /2 width=3 by ex2_intro/
33   ]
34 | #a #I #G #L #V0 #V1 #T0 #T1 #l1 #m1 #_ #_ #IHV01 #IHT01 #X #l2 #m2 #HX
35   elim (cpy_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
36   elim (IHV01 … HV02) -IHV01 -HV02 #V #HV1 #HV2
37   elim (IHT01 … HT02) -T0 #T #HT1 #HT2
38   lapply (lsuby_cpy_trans … HT1 (L.ⓑ{I}V1) ?) -HT1 /2 width=1 by lsuby_succ/
39   lapply (lsuby_cpy_trans … HT2 (L.ⓑ{I}V2) ?) -HT2
40   /3 width=5 by cpy_bind, lsuby_succ, ex2_intro/
41 | #I #G #L #V0 #V1 #T0 #T1 #l1 #m1 #_ #_ #IHV01 #IHT01 #X #l2 #m2 #HX
42   elim (cpy_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
43   elim (IHV01 … HV02) -V0
44   elim (IHT01 … HT02) -T0 /3 width=5 by cpy_flat, ex2_intro/
45 ]
46 qed-.
47
48 (* Basic_1: was: subst1_confluence_neq *)
49 theorem cpy_conf_neq: ∀G,L1,T0,T1,l1,m1. ⦃G, L1⦄ ⊢ T0 ▶[l1, m1] T1 →
50                       ∀L2,T2,l2,m2. ⦃G, L2⦄ ⊢ T0 ▶[l2, m2] T2 →
51                       (l1 + m1 ≤ l2 ∨ l2 + m2 ≤ l1) →
52                       ∃∃T. ⦃G, L2⦄ ⊢ T1 ▶[l2, m2] T & ⦃G, L1⦄ ⊢ T2 ▶[l1, m1] T.
53 #G #L1 #T0 #T1 #l1 #m1 #H elim H -G -L1 -T0 -T1 -l1 -m1
54 [ /2 width=3 by ex2_intro/
55 | #I1 #G #L1 #K1 #V1 #T1 #i0 #l1 #m1 #Hl1 #Hlm1 #HLK1 #HVT1 #L2 #T2 #l2 #m2 #H1 #H2
56   elim (cpy_inv_lref1 … H1) -H1
57   [ #H destruct /3 width=7 by cpy_subst, ex2_intro/
58   | -HLK1 -HVT1 * #I2 #K2 #V2 #Hl2 #Hlm2 #_ #_ elim H2 -H2 #Hlml [ -Hl1 -Hlm2 | -Hl2 -Hlm1 ]
59     [ elim (ylt_yle_false … Hlm1) -Hlm1 /2 width=3 by yle_trans/
60     | elim (ylt_yle_false … Hlm2) -Hlm2 /2 width=3 by yle_trans/
61     ]
62   ]
63 | #a #I #G #L1 #V0 #V1 #T0 #T1 #l1 #m1 #_ #_ #IHV01 #IHT01 #L2 #X #l2 #m2 #HX #H
64   elim (cpy_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
65   elim (IHV01 … HV02 H) -IHV01 -HV02 #V #HV1 #HV2
66   elim (IHT01 … HT02) -T0
67   [ -H #T #HT1 #HT2
68     lapply (lsuby_cpy_trans … HT1 (L2.ⓑ{I}V1) ?) -HT1 /2 width=1 by lsuby_succ/
69     lapply (lsuby_cpy_trans … HT2 (L1.ⓑ{I}V2) ?) -HT2 /3 width=5 by cpy_bind, lsuby_succ, ex2_intro/
70   | -HV1 -HV2 elim H -H /3 width=1 by yle_succ, or_introl, or_intror/
71   ]
72 | #I #G #L1 #V0 #V1 #T0 #T1 #l1 #m1 #_ #_ #IHV01 #IHT01 #L2 #X #l2 #m2 #HX #H
73   elim (cpy_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
74   elim (IHV01 … HV02 H) -V0
75   elim (IHT01 … HT02 H) -T0 -H /3 width=5 by cpy_flat, ex2_intro/
76 ]
77 qed-.
78
79 (* Note: the constant 1 comes from cpy_subst *)
80 (* Basic_1: was: subst1_trans *)
81 theorem cpy_trans_ge: ∀G,L,T1,T0,l,m. ⦃G, L⦄ ⊢ T1 ▶[l, m] T0 →
82                       ∀T2. ⦃G, L⦄ ⊢ T0 ▶[l, 1] T2 → 1 ≤ m → ⦃G, L⦄ ⊢ T1 ▶[l, m] T2.
83 #G #L #T1 #T0 #l #m #H elim H -G -L -T1 -T0 -l -m
84 [ #I #G #L #l #m #T2 #H #Hm
85   elim (cpy_inv_atom1 … H) -H
86   [ #H destruct //
87   | * #J #K #V #i #Hl2i #Hilm2 #HLK #HVT2 #H destruct
88     lapply (ylt_yle_trans … (l+m) … Hilm2)
89     /2 width=5 by cpy_subst, monotonic_yle_plus_sn/
90   ]
91 | #I #G #L #K #V #V2 #i #l #m #Hli #Hilm #HLK #HVW #T2 #HVT2 #Hm
92   lapply (cpy_weak … HVT2 0 (i+1) ? ?) -HVT2 /3 width=1 by yle_plus_dx2_trans, yle_succ/
93   >yplus_inj #HVT2 <(cpy_inv_lift1_eq … HVW … HVT2) -HVT2 /2 width=5 by cpy_subst/
94 | #a #I #G #L #V1 #V0 #T1 #T0 #l #m #_ #_ #IHV10 #IHT10 #X #H #Hm
95   elim (cpy_inv_bind1 … H) -H #V2 #T2 #HV02 #HT02 #H destruct
96   lapply (lsuby_cpy_trans … HT02 (L.ⓑ{I}V1) ?) -HT02 /2 width=1 by lsuby_succ/ #HT02
97   lapply (IHT10 … HT02 Hm) -T0 /3 width=1 by cpy_bind/
98 | #I #G #L #V1 #V0 #T1 #T0 #l #m #_ #_ #IHV10 #IHT10 #X #H #Hm
99   elim (cpy_inv_flat1 … H) -H #V2 #T2 #HV02 #HT02 #H destruct /3 width=1 by cpy_flat/
100 ]
101 qed-.
102
103 theorem cpy_trans_down: ∀G,L,T1,T0,l1,m1. ⦃G, L⦄ ⊢ T1 ▶[l1, m1] T0 →
104                         ∀T2,l2,m2. ⦃G, L⦄ ⊢ T0 ▶[l2, m2] T2 → l2 + m2 ≤ l1 →
105                         ∃∃T. ⦃G, L⦄ ⊢ T1 ▶[l2, m2] T & ⦃G, L⦄ ⊢ T ▶[l1, m1] T2.
106 #G #L #T1 #T0 #l1 #m1 #H elim H -G -L -T1 -T0 -l1 -m1
107 [ /2 width=3 by ex2_intro/
108 | #I #G #L #K #V #W #i1 #l1 #m1 #Hli1 #Hilm1 #HLK #HVW #T2 #l2 #m2 #HWT2 #Hlm2l1
109   lapply (yle_trans … Hlm2l1 … Hli1) -Hlm2l1 #Hlm2i1
110   lapply (cpy_weak … HWT2 0 (i1+1) ? ?) -HWT2 /3 width=1 by yle_succ, yle_pred_sn/ -Hlm2i1
111   >yplus_inj #HWT2 <(cpy_inv_lift1_eq … HVW … HWT2) -HWT2 /3 width=9 by cpy_subst, ex2_intro/
112 | #a #I #G #L #V1 #V0 #T1 #T0 #l1 #m1 #_ #_ #IHV10 #IHT10 #X #l2 #m2 #HX #lm2l1
113   elim (cpy_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
114   lapply (lsuby_cpy_trans … HT02 (L.ⓑ{I}V1) ?) -HT02 /2 width=1 by lsuby_succ/ #HT02
115   elim (IHV10 … HV02) -IHV10 -HV02 // #V
116   elim (IHT10 … HT02) -T0 /2 width=1 by yle_succ/ #T #HT1 #HT2
117   lapply (lsuby_cpy_trans … HT2 (L.ⓑ{I}V) ?) -HT2 /3 width=6 by cpy_bind, lsuby_succ, ex2_intro/
118 | #I #G #L #V1 #V0 #T1 #T0 #l1 #m1 #_ #_ #IHV10 #IHT10 #X #l2 #m2 #HX #lm2l1
119   elim (cpy_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
120   elim (IHV10 … HV02) -V0 //
121   elim (IHT10 … HT02) -T0 /3 width=6 by cpy_flat, ex2_intro/
122 ]
123 qed-.