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 notation "hvbox( [ term 46 d ⬐ break term 46 V ] break term 46 T )"
16 non associative with precedence 46
17 for @{ 'DSubst $V $d $T }.
19 include "basic_2/unfold/delift_lift.ma".
20 include "apps_2/functional/lift.ma".
22 (* FUNCTIONAL DELIFTING SUBSTITUTION ****************************************)
24 let rec fdsubst W d U on U ≝ match U with
25 [ TAtom I ⇒ match I with
27 | LRef i ⇒ tri … i d (#i) (↑[0, i] W) (#(i-1))
30 | TPair I V T ⇒ match I with
31 [ Bind2 a I ⇒ ⓑ{a,I} (fdsubst W d V). (fdsubst W (d+1) T)
32 | Flat2 I ⇒ ⓕ{I} (fdsubst W d V). (fdsubst W d T)
37 "functional delifting substitution"
38 'DSubst V d T = (fdsubst V d T).
40 (* Main properties **********************************************************)
42 theorem fdsubst_delift: ∀K,V,T,L,d.
43 ⇩[0, d] L ≡ K. ⓓV → L ⊢ ▼*[d, 1] T ≡ [d ⬐ V] T.
45 [ * #i #L #d #HLK normalize in ⊢ (? ? ? ? ? %); /2 width=3/
46 elim (lt_or_eq_or_gt i d) #Hid
47 [ -HLK >(tri_lt ?????? Hid) /3 width=3/
48 | destruct >tri_eq /4 width=4 by tpss_strap2, tps_subst, le_n, ex2_intro/ (**) (* too slow without trace *)
49 | -HLK >(tri_gt ?????? Hid) /3 width=3/
51 | * /3 width=1/ /4 width=1/
55 (* Main inversion properties ************************************************)
57 theorem fdsubst_inv_delift: ∀K,V,T1,L,T2,d. ⇩[0, d] L ≡ K. ⓓV →
58 L ⊢ ▼*[d, 1] T1 ≡ T2 → [d ⬐ V] T1 = T2.
60 [ * #i #L #T2 #d #HLK #H
61 [ -HLK >(delift_inv_sort1 … H) -H //
62 | elim (lt_or_eq_or_gt i d) #Hid normalize
63 [ -HLK >(delift_inv_lref1_lt … H) -H // /2 width=1/
65 elim (delift_inv_lref1_be … H ? ?) -H // #K0 #V0 #V2 #HLK0
66 lapply (ldrop_mono … HLK0 … HLK) -HLK0 -HLK #H >minus_plus <minus_n_n #HV2 #HVT2 destruct
67 >(delift_inv_refl_O2 … HV2) -V >(flift_inv_lift … HVT2) -V2 //
68 | -HLK >(delift_inv_lref1_ge … H) -H // /2 width=1/
70 | -HLK >(delift_inv_gref1 … H) -H //
72 | * [ #a ] #I #V1 #T1 #IHV1 #IHT1 #L #X #d #HLK #H
73 [ elim (delift_inv_bind1 … H) -H #V2 #T2 #HV12 #HT12 #H destruct
74 <(IHV1 … HV12) -IHV1 -HV12 // <(IHT1 … HT12) -IHT1 -HT12 // /2 width=1/
75 | elim (delift_inv_flat1 … H) -H #V2 #T2 #HV12 #HT12 #H destruct
76 <(IHV1 … HV12) -IHV1 -HV12 // <(IHT1 … HT12) -IHT1 -HT12 //