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/tps_lift.ma".
17 (* PARTIAL SUBSTITUTION ON TERMS ********************************************)
19 (* Split properties *********************************************************)
21 lemma tps_split_up: ∀L,T1,T2,d,e. L ⊢ T1 [d, e] ≫ T2 → ∀i. d ≤ i → i ≤ d + e →
22 ∃∃T. L ⊢ T1 [d, i - d] ≫ T & L ⊢ T [i, d + e - i] ≫ T2.
23 #L #T1 #T2 #d #e #H elim H -L T1 T2 d e
26 | #L #K #V #W #i #d #e #Hdi #Hide #HLK #HVW #j #Hdj #Hjde
29 >(plus_minus_m_m_comm j d) in ⊢ (% → ?) // -Hdj /3/
31 generalize in match Hide -Hide (**) (* rewriting in the premises, rewrites in the goal too *)
32 >(plus_minus_m_m_comm … Hjde) in ⊢ (% → ?) -Hjde /4/
34 | #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #i #Hdi #Hide
35 elim (IHV12 i ? ?) -IHV12 // #V #HV1 #HV2
36 elim (IHT12 (i + 1) ? ?) -IHT12 [2: /2 by arith4/ |3: /2/ ] (* just /2/ is too slow *)
37 -Hdi Hide >arith_c1 >arith_c1x #T #HT1 #HT2
38 @ex2_1_intro [2,3: @tps_bind | skip ] (**) (* explicit constructors *)
39 [3: @HV1 |4: @HT1 |5: // |1,2: skip | /3 width=5/ ]
40 | #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #i #Hdi #Hide
41 elim (IHV12 i ? ?) -IHV12 // elim (IHT12 i ? ?) -IHT12 //
46 lemma tps_inv_lift1_up: ∀L,U1,U2,dt,et. L ⊢ U1 [dt, et] ≫ U2 →
47 ∀K,d,e. ↓[d, e] L ≡ K → ∀T1. ↑[d, e] T1 ≡ U1 →
48 d ≤ dt → dt ≤ d + e → d + e ≤ dt + et →
49 ∃∃T2. K ⊢ T1 [d, dt + et - (d + e)] ≫ T2 & ↑[d, e] T2 ≡ U2.
50 #L #U1 #U2 #dt #et #HU12 #K #d #e #HLK #T1 #HTU1 #Hddt #Hdtde #Hdedet
51 elim (tps_split_up … HU12 (d + e) ? ?) -HU12 // -Hdedet #U #HU1 #HU2
52 lapply (tps_weak … HU1 d e ? ?) -HU1 // <plus_minus_m_m_comm // -Hddt Hdtde #HU1
53 lapply (tps_inv_lift1_eq … HU1 … HTU1) -HU1 #HU1 destruct -U1;
54 elim (tps_inv_lift1_ge … HU2 … HLK … HTU1 ?) -HU2 HLK HTU1 // <minus_plus_m_m /2/