6 (*#* #caption "main properties of drop" #clauses *)
8 Section confluence. (*****************************************************)
10 Tactic Definition IH :=
12 [ H1: (drop ?1 ?2 c ?3); H2: (drop ?1 ?2 c ?4) |- ? ] ->
13 LApply (H ?4 ?2 ?1); [ Clear H H2; Intros H | XAuto ];
14 LApply (H ?3); [ Clear H H1; Intros | XAuto ].
16 (*#* #caption "confluence, first case" *)
17 (*#* #cap #alpha c in C, x1 in C1, x2 in C2, d in i *)
19 Theorem drop_mono : (c,x1:?; d,h:?) (drop h d c x1) ->
20 (x2:?) (drop h d c x2) -> x1 = x2.
23 Intros; Repeat DropGenBase; Rewrite H0; XAuto.
27 XElim h; Intros; Repeat DropGenBase; Try Rewrite <- H0; XEAuto.
29 Intros; Repeat DropGenBase; Rewrite H1; Rewrite H2; Rewrite H5 in H3;
33 (*#* #caption "confluence, second case" *)
34 (*#* #cap #alpha c in C1, c0 in E1, e in C2, e0 in E2, u in V1, v in V2, i in k, d in i *)
36 Theorem drop_conf_lt: (b:?; i:?; u:?; c0,c:?)
37 (drop i (0) c (CTail c0 (Bind b) u)) ->
38 (e:?; h,d:?) (drop h (S (plus i d)) c e) ->
39 (EX v e0 | u = (lift h d v) &
40 (drop i (0) e (CTail e0 (Bind b) v)) &
47 Rewrite H in H0; Clear H.
51 (* case 2.1 : CSort *)
53 (* case 2.2 : CTail k *)
54 XElim k; Intros; Repeat DropGenBase; Rewrite H2; Clear H2 H3 e t.
55 (* case 2.2.1 : Bind *)
56 LApply (H u c0 c); [ Clear H H0 H1; Intros H | XAuto ].
57 LApply (H x0 h d); [ Clear H H9; Intros H | XAuto ].
59 (* case 2.2.2 : Flat *)
60 LApply H0; [ Clear H H0 H1; Intros H | XAuto ].
61 LApply (H x0 h d); [ Clear H H9; Intros H | XAuto ].
65 (*#* #caption "confluence, third case" *)
66 (*#* #cap #alpha c in C, a in C1, e in C2, i in k, d in i *)
68 Theorem drop_conf_ge: (i:?; a,c:?) (drop i (0) c a) ->
69 (e:?; h,d:?) (drop h d c e) -> (le (plus d h) i) ->
70 (drop (minus i h) (0) e a).
74 DropGenBase; Rewrite H in H0; Clear H c.
75 Inversion H1; Rewrite H2; Simpl; Clear H1.
76 PlusO; Rewrite H in H0; Rewrite H1 in H0; Clear H H1 d h.
77 DropGenBase; Rewrite <- H; XAuto.
80 (* case 2.1 : CSort *)
81 Intros; Repeat DropGenBase; Rewrite H1; Rewrite H0; XAuto.
82 (* case 2.2 : CTail k *)
83 XElim k; Intros; DropGenBase;
85 [ NewInduction h; DropGenBase;
86 [ Rewrite <- H2; Simpl; XAuto | Clear IHh ]
87 | DropGenBase; Rewrite H2; Clear IHd H2 H4 e t ] ).
88 (* case 2.2.1 : Bind, d = 0, h > 0 *)
89 LApply (H a c); [ Clear H H0 H1; Intros H | XAuto ].
90 LApply (H e h (0)); XAuto.
91 (* case 2.2.2 : Bind, d > 0 *)
92 LApply (H a c); [ Clear H H0 H1; Intros H | XAuto ].
93 LApply (H x0 h d); [ Clear H H4; Intros H | XAuto ].
94 LApply H; [ Clear H; Simpl in H3; Intros H | XAuto ].
95 Rewrite <- minus_Sn_m; XEAuto.
96 (* case 2.2.3 : Flat, d = 0, h > 0 *)
97 LApply H0; [ Clear H H0 H1; Intros H | XAuto ].
98 LApply (H e (S h) (0)); XAuto.
99 (* case 2.2.4 : Flat, d > 0 *)
100 LApply H0; [ Clear H H0 H1; Intros H | XAuto ].
101 LApply (H x0 h (S d)); [ Clear H H4; Intros H | XAuto ].
102 LApply H; [ Clear H; Simpl in H3; Intros H | XAuto ].
103 Rewrite <- minus_Sn_m in H; [ Idtac | XEAuto ].
104 Rewrite <- minus_Sn_m; XEAuto.
109 Section transitivity. (***************************************************)
111 (*#* #caption "transitivity, first case" *)
112 (*#* #cap #alpha c1 in C1, c2 in C2, e1 in D1, e2 in D2, d in i, i in k *)
114 Theorem drop_trans_le : (i,d:?) (le i d) ->
115 (c1,c2:?; h:?) (drop h d c1 c2) ->
116 (e2:?) (drop i (0) c2 e2) ->
117 (EX e1 | (drop i (0) c1 e1) & (drop h (minus d i) e1 e2)).
121 DropGenBase; Rewrite H1 in H0.
122 Rewrite <- minus_n_O; XEAuto.
124 Intros i IHi; XElim d.
125 (* case 2.1 : d = 0 *)
127 (* case 2.2 : d > 0 *)
128 Intros d IHd; XElim c1.
129 (* case 2.2.1 : CSort *)
131 DropGenBase; Rewrite H0 in H1.
132 DropGenBase; Rewrite H1; XEAuto.
133 (* case 2.2.2 : CTail k *)
134 Intros c1 IHc; XElim k; Intros;
135 DropGenBase; Rewrite H0 in H1; Rewrite H2; Clear IHd H0 H2 c2 t;
137 (* case 2.2.2.1 : Bind *)
138 LApply (IHi d); [ Clear IHi; Intros IHi | XAuto ].
139 LApply (IHi c1 x0 h); [ Clear IHi H8; Intros IHi | XAuto ].
140 LApply (IHi e2); [ Clear IHi H0; Intros IHi | XAuto ].
142 (* case 2.2.2.2 : Flat *)
143 LApply (IHc x0 h); [ Clear IHc H8; Intros IHc | XAuto ].
144 LApply (IHc e2); [ Clear IHc H0; Intros IHc | XAuto ].
148 (*#* #caption "transitivity, second case" *)
149 (*#* #cap #alpha c1 in C1, c2 in C, e2 in C2, d in i, i in k *)
151 Theorem drop_trans_ge : (i:?; c1,c2:?; d,h:?) (drop h d c1 c2) ->
152 (e2:?) (drop i (0) c2 e2) -> (le d i) ->
153 (drop (plus i h) (0) c1 e2).
157 DropGenBase; Rewrite <- H0.
158 Inversion H1; Rewrite H2 in H; XAuto.
160 Intros i IHi; XElim c1; Simpl.
161 (* case 2.1: CSort *)
163 DropGenBase; Rewrite H in H0.
164 DropGenBase; Rewrite H0; XAuto.
165 (* case 2.2: CTail *)
166 Intros c1 IHc; XElim d.
167 (* case 2.2.1: d = 0 *)
169 (* case 2.2.1.1: h = 0 *)
170 DropGenBase; Rewrite <- H in H0;
171 DropGenBase; Rewrite <- plus_n_O; XAuto.
172 (* case 2.2.1.2: h > 0 *)
173 DropGenBase; Rewrite <- plus_n_Sm.
174 Apply drop_drop; RRw; XEAuto. (**) (* explicit constructor *)
175 (* case 2.2.2: d > 0 *)
176 Intros d IHd; Intros.
177 DropGenBase; Rewrite H in IHd; Rewrite H in H0; Rewrite H2 in IHd; Rewrite H2; Clear IHd H H2 c2 t;
178 DropGenBase; Apply drop_drop; NewInduction k; Simpl; XEAuto. (**) (* explicit constructor *)
183 Tactic Definition DropDis :=
185 [ H1: (drop ?1 ?2 ?3 ?4); H2: (drop ?1 ?2 ?3 ?5) |- ? ] ->
186 LApply (drop_mono ?3 ?5 ?2 ?1); [ Intros H_x | XAuto ];
187 LApply (H_x ?4); [ Clear H_x H1; Intros H1; Rewrite H1 in H2 | XAuto ]
188 | [ H1: (drop ?0 (0) ?1 (CTail ?2 (Bind ?3) ?4));
189 H2: (drop ?5 (S (plus ?0 ?6)) ?1 ?7) |- ? ] ->
190 LApply (drop_conf_lt ?3 ?0 ?4 ?2 ?1); [ Clear H1; Intros H1 | XAuto ];
191 LApply (H1 ?7 ?5 ?6); [ Clear H1 H2; Intros H1 | XAuto ];
193 | [ _: (drop ?0 (0) ?1 ?2); _: (drop ?5 (0) ?1 ?7);
194 _: (lt ?5 ?0) |- ? ] ->
195 LApply (drop_conf_ge ?0 ?2 ?1); [ Intros H_x | XAuto ];
196 LApply (H_x ?7 ?5 (0)); [ Clear H_x; Intros H_x | XAuto ];
197 Simpl in H_x; LApply H_x; [ Clear H_x; Intros | XAuto ]
198 | [ _: (drop ?1 (0) ?2 (CTail ?3 (Bind ?) ?));
199 _: (drop (1) ?1 ?2 ?4) |- ? ] ->
200 LApply (drop_conf_ge (S ?1) ?3 ?2); [ Intros H_x | XEAuto ];
201 LApply (H_x ?4 (1) ?1); [ Clear H_x; Intros H_x | XAuto ];
202 LApply H_x; [ Clear H_x; Intros | Rewrite plus_sym; XAuto ]; (
204 [ H: (drop (minus (S ?1) (1)) (0) ?4 ?3) |- ? ] ->
205 Simpl in H; Rewrite <- minus_n_O in H )
206 | [ H0: (drop ?0 (0) ?1 ?2); H2: (lt ?6 ?0);
207 H1: (drop (1) ?6 ?1 ?7) |- ? ] ->
208 LApply (drop_conf_ge ?0 ?2 ?1); [ Intros H_x | XAuto ];
209 LApply (H_x ?7 (1) ?6); [ Clear H_x; Intros H_x | XAuto ];
210 LApply H_x; [ Clear H_x; Intros | Rewrite plus_sym; XAuto ]
211 | [ H0: (drop ?0 (0) ?1 ?2);
212 H1: (drop ?5 ?6 ?1 ?7) |- ? ] ->
213 LApply (drop_conf_ge ?0 ?2 ?1); [ Intros H_x | XAuto ];
214 LApply (H_x ?7 ?5 ?6); [ Clear H_x; Intros H_x | XAuto ];
215 LApply H_x; [ Clear H_x; Intros | XAuto ]
217 H1: (drop ?3 ?2 ?4 ?5); H2: (drop ?1 (0) ?5 ?6) |- ? ] ->
218 LApply (drop_trans_le ?1 ?2); [ Intros H_x | XAuto ];
219 LApply (H_x ?4 ?5 ?3); [ Clear H_x H1; Intros H_x | XAuto ];
220 LApply (H_x ?6); [ Clear H_x H2; Intros H_x | XAuto ];
223 H1: (drop ?3 ?1 ?4 ?5); H2: (drop ?2 (0) ?5 ?6) |- ? ] ->
224 LApply (drop_trans_ge ?2 ?4 ?5 ?1 ?3); [ Clear H1; Intros H1 | XAuto ];
225 LApply (H1 ?6); [ Clear H1 H2; Intros H1 | XAuto ];
226 LApply H1; [ Clear H1; Intros | XAuto ].