]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/substitution/cpye_lift.ma
we start total substitution ...
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / substitution / cpye_lift.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/relocation/cny_lift.ma".
16 include "basic_2/substitution/fqup.ma".
17 include "basic_2/substitution/cpys_lift.ma".
18 include "basic_2/substitution/cpye.ma".
19
20 (* EVALUATION FOR CONTEXT-SENSITIVE EXTENDED SUBSTITUTION ON TERMS **********)
21
22 lemma cpye_subst: ∀I,G,L,K,V1,V2,W2,i,d,e. d ≤ yinj i → i < d + e →
23                   ⇩[i] L ≡ K.ⓑ{I}V1 → ⦃G, K⦄ ⊢ V1 ▶*[O, ⫰(d+e-i)] 𝐍⦃V2⦄ →
24                   ⇧[O, i+1] V2 ≡ W2 → ⦃G, L⦄ ⊢ #i ▶*[d, e] 𝐍⦃W2⦄.
25 #I #G #L #K #V1 #V2 #W2 #i #d #e #Hdi #Hide #HLK *
26 /4 width=13 by cpys_subst, cny_subst_aux, ldrop_fwd_drop2, conj/
27 qed.
28
29 lemma cpys_total: ∀G,L,T1,d,e. ∃T2. ⦃G, L⦄ ⊢ T1 ▶*[d, e] 𝐍⦃T2⦄.
30 #G #L #T1 @(fqup_wf_ind_eq … G L T1) -G -L -T1
31 #Z #Y #X #IH #G #L * *
32 [ #k #HG #HL #HT #d #e destruct -IH /2 width=2 by ex_intro/
33 | #i #HG #HL #HT #d #e destruct
34   elim (ylt_split i d) /3 width=2 by cpye_skip, ex_intro/
35   elim (ylt_split i (d+e)) /3 width=2 by cpye_top, ex_intro/
36   elim (lt_or_ge i (|L|)) /3 width=2 by cpye_free, ex_intro/
37   #Hi #Hide #Hdi elim (ldrop_O1_lt L i) // -Hi
38   #I #K #V1 #HLK elim (IH G K V1 … 0 (⫰(d+e-i))) -IH /2 width=2 by fqup_lref/
39   #V2 elim (lift_total V2 0 (i+1)) /3 width=8 by ex_intro, cpye_subst/
40 | #p #HG #HL #HT #d #e destruct -IH /2 width=2 by ex_intro/
41 | #a #I #V1 #T1 #HG #HL #HT #d #e destruct
42   elim (IH G L V1 … d e) // elim (IH G (L.ⓑ{I}V1) T1 … (⫯d) e) //
43   /3 width=2 by cpye_bind, ex_intro/
44 | #I #V1 #T1 #HG #HL #HT #d #e destruct
45   elim (IH G L V1 … d e) // elim (IH G L T1 … d e) //
46   /3 width=2 by cpye_flat, ex_intro/
47 ]
48 qed-.