+++ /dev/null
-(*#* #stop file *)
-
-Require lift_defs.
-
- Section lift_ini. (*******************************************************)
-
- Tactic Definition IH :=
- Match Context With
- | [ H1: (lift ?1 ?2 t) = (lift ?1 ?2 ?3) |- ? ] ->
- LApply (H ?3 ?1 ?2); [ Clear H H1; Intros | XAuto ]
- | [ H1: (lift ?1 ?2 t0) = (lift ?1 ?2 ?3) |- ? ] ->
- LApply (H0 ?3 ?1 ?2); [ Clear H0 H1; Intros | XAuto ].
-
-(*#* #caption "main properties of lift" #clauses lift_props *)
-
-(*#* #caption "injectivity" *)
-(*#* #cap #alpha x in T1, t in T2, d in i *)
-
- Theorem lift_inj : (x,t:?; h,d:?) (lift h d x) = (lift h d t) -> x = t.
- XElim x.
-(* case 1 : TSort *)
- Intros; Rewrite lift_sort in H; LiftGenBase; XAuto.
-(* case 2 : TLRef n *)
- Intros; Apply (lt_le_e n d); Intros.
-(* case 2.1 : n < d *)
- Rewrite lift_lref_lt in H; [ LiftGenBase; XAuto | XAuto ].
-(* case 2.2 : n >= d *)
- Rewrite lift_lref_ge in H; [ LiftGenBase; XAuto | XAuto ].
-(* case 3 : TTail k *)
- XElim k; Intros; [ Rewrite lift_bind in H1 | Rewrite lift_flat in H1 ];
- LiftGenBase; Rewrite H1; IH; IH; XAuto.
- Qed.
-
- End lift_ini.
-
- Section lift_gen_lift. (**************************************************)
-
- Tactic Definition IH :=
- Match Context With
- | [ H_x: (lift ?0 ?1 t) = (lift ?2 (plus ?3 ?0) ?4) |- ? ] ->
- LApply (H ?4 ?0 ?2 ?1 ?3); [ Clear H; Intros H | XAuto ];
- LApply H; [ Clear H H_x; Intros H | XAuto ];
- XElim H; Intros
- | [ H_x: (lift ?0 ?1 t0) = (lift ?2 (plus ?3 ?0) ?4) |- ? ] ->
- LApply (H0 ?4 ?0 ?2 ?1 ?3); [ Clear H0; Intros H0 | XAuto ];
- LApply H0; [ Clear H0 H_x; Intros H0 | XAuto ];
- XElim H0; Intros.
-
-(*#* #caption "generation lemma for lift" *)
-(*#* #cap #cap t1 #alpha t2 in T, x in T2, d1 in i1, d2 in i2 *)
-
- Theorem lift_gen_lift : (t1,x:?; h1,h2,d1,d2:?) (le d1 d2) ->
- (lift h1 d1 t1) = (lift h2 (plus d2 h1) x) ->
- (EX t2 | x = (lift h1 d1 t2) &
- t1 = (lift h2 d2 t2)
- ).
- XElim t1; Intros.
-(* case 1 : TSort *)
- Rewrite lift_sort in H0.
- LiftGenBase; Rewrite H0; Clear H0 x.
- EApply ex2_intro; Rewrite lift_sort; XAuto.
-(* case 2 : TLRef n *)
- Apply (lt_le_e n d1); Intros.
-(* case 2.1 : n < d1 *)
- Rewrite lift_lref_lt in H0; [ Idtac | XAuto ].
- LiftGenBase; Rewrite H0; Clear H0 x.
- EApply ex2_intro; Rewrite lift_lref_lt; XEAuto.
-(* case 2.2 : n >= d1 *)
- Rewrite lift_lref_ge in H0; [ Idtac | XAuto ].
- Apply (lt_le_e n d2); Intros.
-(* case 2.2.1 : n < d2 *)
- LiftGenBase; Rewrite H0; Clear H0 x.
- EApply ex2_intro; [ Rewrite lift_lref_ge | Rewrite lift_lref_lt ]; XEAuto.
-(* case 2.2.2 : n >= d2 *)
- Apply (lt_le_e n (plus d2 h2)); Intros.
-(* case 2.2.2.1 : n < d2 + h2 *)
- EApply lift_gen_lref_false; [ Idtac | Idtac | Apply H0 ];
- [ XAuto | Rewrite plus_permute_2_in_3; XAuto ].
-(* case 2.2.2.2 : n >= d2 + h2 *)
- Rewrite (le_plus_minus_sym h2 (plus n h1)) in H0; [ Idtac | XEAuto ].
- LiftGenBase; Rewrite H0; Clear H0 x.
- EApply ex2_intro;
- [ Rewrite le_minus_plus; [ Idtac | XEAuto ]
- | Rewrite (le_plus_minus_sym h2 n); [ Idtac | XEAuto ] ];
- Rewrite lift_lref_ge; XEAuto.
-(* case 3 : TTail k *)
- NewInduction k.
-(* case 3.1 : Bind *)
- Rewrite lift_bind in H2.
- LiftGenBase; Rewrite H2; Clear H2 x.
- IH; Rewrite H; Rewrite H2; Clear H H2 x0.
- Arith4In H4 d2 h1; IH; Rewrite H; Rewrite H0; Clear H H0 x1 t t0.
- EApply ex2_intro; Rewrite lift_bind; XAuto.
-(* case 3.2 : Flat *)
- Rewrite lift_flat in H2.
- LiftGenBase; Rewrite H2; Clear H2 x.
- IH; Rewrite H; Rewrite H2; Clear H H2 x0.
- IH; Rewrite H; Rewrite H0; Clear H H0 x1 t t0.
- EApply ex2_intro; Rewrite lift_flat; XAuto.
- Qed.
-
- End lift_gen_lift.
-
- Tactic Definition LiftGen :=
- Match Context With
- | [ H: (lift ?1 ?2 ?3) = (lift ?1 ?2 ?4) |- ? ] ->
- LApply (lift_inj ?3 ?4 ?1 ?2); [ Clear H; Intros | XAuto ]
- | [ H: (lift ?0 ?1 ?2) = (lift ?3 (plus ?4 ?0) ?5) |- ? ] ->
- LApply (lift_gen_lift ?2 ?5 ?0 ?3 ?1 ?4); [ Intros H_x | XAuto ];
- LApply H_x; [ Clear H H_x; Intros H | XAuto ];
- XElim H; Intros
- | [ H: (lift (1) (0) ?1) = (lift (1) (S ?2) ?3) |- ? ] ->
- LApply (lift_gen_lift ?1 ?3 (1) (1) (0) ?2); [ Intros H_x | XAuto ];
- LApply H_x; [ Clear H_x H; Intros H | Arith7' ?2; XAuto ];
- XElim H; Intros
- | _ -> LiftGenBase.