-
Notifications
You must be signed in to change notification settings - Fork 9
/
defeq.v
568 lines (535 loc) · 20.7 KB
/
defeq.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
(*
* Thoughts on definitional equality
*)
Require Import List Vector.
Require Import Ornamental.Ornaments.
(*
* The first place we ever encountered definitional equality problems
* was in lifting proofs about app. Let's give that a try for context.
*)
Preprocess Module List as List' { opaque (* ignore these: *)
RelationClasses
Nat
Coq.Init.Nat
}.
Set DEVOID lift type.
Lift list Vector.t in List'.Coq_Init_Datatypes_app as appV.
(*
* Here is the term this generates:
*)
Definition appV_term (A : Type) (l m : {H : nat & t A H}) : {H : nat & t A H} :=
existT (fun H : nat => t A H)
(projT1
(VectorDef.t_rect A
(fun (n : nat) (_ : VectorDef.t A n) =>
{H : nat & t A H} -> {H : nat & t A H})
(fun m0 : {H : nat & t A H} =>
existT (fun H : nat => t A H) (projT1 m0) (projT2 m0))
(fun (h : A) (n : nat) (_ : VectorDef.t A n)
(H : {H : nat & t A H} -> {H : nat & t A H})
(m0 : {H0 : nat & t A H0}) =>
existT (fun H0 : nat => VectorDef.t A H0)
(S
(projT1
(H (existT (fun H0 : nat => t A H0) (projT1 m0) (projT2 m0)))))
(VectorDef.cons A h
(projT1
(H (existT (fun H0 : nat => t A H0) (projT1 m0) (projT2 m0))))
(projT2
(H (existT (fun H0 : nat => t A H0) (projT1 m0) (projT2 m0))))))
(projT1 l) (projT2 l)
(existT (fun H : nat => t A H) (projT1 m) (projT2 m))))
(projT2
(VectorDef.t_rect A
(fun (n : nat) (_ : VectorDef.t A n) =>
{H : nat & t A H} -> {H : nat & t A H})
(fun m0 : {H : nat & t A H} =>
existT (fun H : nat => t A H) (projT1 m0) (projT2 m0))
(fun (h : A) (n : nat) (_ : VectorDef.t A n)
(H : {H : nat & t A H} -> {H : nat & t A H})
(m0 : {H0 : nat & t A H0}) =>
existT (fun H0 : nat => VectorDef.t A H0)
(S
(projT1
(H (existT (fun H0 : nat => t A H0) (projT1 m0) (projT2 m0)))))
(VectorDef.cons A h
(projT1
(H (existT (fun H0 : nat => t A H0) (projT1 m0) (projT2 m0))))
(projT2
(H (existT (fun H0 : nat => t A H0) (projT1 m0) (projT2 m0))))))
(projT1 l) (projT2 l)
(existT (fun H : nat => t A H) (projT1 m) (projT2 m)))).
(*
* Note the explicit eta of packed vectors s to (existT _ (projT1 s) (projT2 s)).
* There is a reason for this. Consider the alternative term that we get
* when we disable the identity rule:
*)
Definition appV_bad (A : Type) (l m : {H : nat & t A H}) : {H : nat & t A H} :=
VectorDef.t_rect A
(fun (n : nat) (_ : VectorDef.t A n) =>
{H : nat & t A H} -> {H : nat & t A H}) (fun m0 : {H : nat & t A H} => m0)
(fun (h : A) (n : nat) (_ : VectorDef.t A n)
(H : {H : nat & t A H} -> {H : nat & t A H})
(m0 : {H0 : nat & t A H0}) =>
existT (fun H0 : nat => VectorDef.t A H0) (S (projT1 (H m0)))
(VectorDef.cons A h (projT1 (H m0)) (projT2 (H m0))))
(projT1 l) (projT2 l) m.
(*
* Indeed, this behaves the same way. But the problem happens when we look at
* lifting definitional equalities. For example, with the identity rule we can lift
* app_nil_r without issue:
*)
Lift list Vector.t in List'.app_nil_r as appV_nil_r { opaque f_equal }.
(*
* That gives us this term:
*)
Definition appV_nil_r_term (A : Type) (l : {H : nat & t A H}) : existT (fun H : nat => t A H)
(projT1
(appV A (existT (fun H : nat => t A H) (projT1 l) (projT2 l))
(existT (fun H : nat => t A H) 0 (VectorDef.nil A))))
(projT2
(appV A (existT (fun H : nat => t A H) (projT1 l) (projT2 l))
(existT (fun H : nat => t A H) 0 (VectorDef.nil A)))) =
existT (fun H : nat => t A H) (projT1 l) (projT2 l) :=
VectorDef.t_rect A
(fun (n : nat) (t0 : VectorDef.t A n) =>
existT (fun H : nat => t A H)
(projT1
(appV A
(existT (fun H : nat => t A H) n t0)
(existT (fun H : nat => t A H) 0 (VectorDef.nil A))))
(projT2
(appV A
(existT (fun H : nat => t A H) n t0)
(existT (fun H : nat => t A H) 0 (VectorDef.nil A)))) =
existT (fun H : nat => t A H) n t0) eq_refl
(fun (h : A) (n : nat) (t0 : VectorDef.t A n)
(H : existT (fun H : nat => t A H)
(projT1
(appV A
(existT (fun H : nat => t A H) n t0)
(existT (fun H : nat => t A H) 0 (VectorDef.nil A))))
(projT2
(appV A
(existT (fun H : nat => t A H) n t0)
(existT (fun H : nat => t A H) 0 (VectorDef.nil A)))) =
existT (fun H : nat => t A H) n t0) =>
eq_ind
(existT (fun H0 : nat => VectorDef.t A H0)
(S
(projT1
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A)))))
(VectorDef.cons A h
(projT1
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))
(projT2
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))))
(fun y : {H0 : nat & t A H0} =>
existT (fun H0 : nat => VectorDef.t A H0)
(S
(projT1
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A)))))
(VectorDef.cons A h
(projT1
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))
(projT2
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))) =
existT (fun H0 : nat => t A H0) (projT1 y) (projT2 y))
(eq_ind
(fun l0 : {H0 : nat & t A H0} =>
existT (fun H0 : nat => VectorDef.t A H0) (S (projT1 l0))
(VectorDef.cons A h (projT1 l0) (projT2 l0)))
(fun y : {H0 : nat & t A H0} -> {H0 : nat & t A H0} =>
existT (fun H0 : nat => VectorDef.t A H0)
(S
(projT1
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A)))))
(VectorDef.cons A h
(projT1
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))
(projT2
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))) =
existT (fun H0 : nat => t A H0)
(projT1
(y
(existT (fun H0 : nat => t A H0)
(projT1
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))
(projT2
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A)))))))
(projT2
(y
(existT (fun H0 : nat => t A H0)
(projT1
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))
(projT2
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))))))
eq_refl
(fun l0 : {H0 : nat & t A H0} =>
existT (fun H0 : nat => VectorDef.t A H0) (S (projT1 l0))
(VectorDef.cons A h (projT1 l0) (projT2 l0))) eq_refl)
(existT (fun H0 : nat => VectorDef.t A H0)
(S n)
(VectorDef.cons A h n t0))
(eq_ind
(existT (fun H0 : nat => t A H0)
(projT1
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))
(projT2
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A)))))
(fun y : {H0 : nat & t A H0} =>
existT (fun H0 : nat => VectorDef.t A H0)
(S
(projT1
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A)))))
(VectorDef.cons A h
(projT1
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))
(projT2
(appV A
(existT (fun H0 : nat => t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))) =
existT (fun H0 : nat => VectorDef.t A H0) (S (projT1 y))
(VectorDef.cons A h (projT1 y) (projT2 y))) eq_refl
(existT (fun H0 : nat => t A H0) n t0) H))
(projT1 l)
(projT2 l).
(*
* In contrast, without identity, we get this:
*)
Fail Definition appV_nil_r_bad (A : Type) (l : {H : nat & t A H}) : appV_bad A l (existT (fun H : nat => t A H) 0 (VectorDef.nil A)) = l :=
VectorDef.t_rect A
(fun (n : nat) (t0 : VectorDef.t A n) =>
appV_bad A (existT (fun H : nat => VectorDef.t A H) n t0)
(existT (fun H : nat => t A H) 0 (VectorDef.nil A)) =
existT (fun H : nat => VectorDef.t A H) n t0) eq_refl
(fun (h : A) (n : nat) (t0 : VectorDef.t A n)
(H : appV_bad A (existT (fun H : nat => VectorDef.t A H) n t0)
(existT (fun H : nat => t A H) 0 (VectorDef.nil A)) =
existT (fun H : nat => VectorDef.t A H) n t0) =>
eq_ind
(existT (fun H0 : nat => VectorDef.t A H0)
(S
(projT1
(appV_bad A (existT (fun H0 : nat => VectorDef.t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A)))))
(VectorDef.cons A h
(projT1
(appV_bad A (existT (fun H0 : nat => VectorDef.t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))
(projT2
(appV_bad A (existT (fun H0 : nat => VectorDef.t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))))
(fun y : {H0 : nat & t A H0} =>
existT (fun H0 : nat => VectorDef.t A H0)
(S
(projT1
(appV_bad A (existT (fun H0 : nat => VectorDef.t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A)))))
(VectorDef.cons A h
(projT1
(appV_bad A (existT (fun H0 : nat => VectorDef.t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))
(projT2
(appV_bad A (existT (fun H0 : nat => VectorDef.t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))) =
y)
(eq_ind
(fun l0 : {H0 : nat & t A H0} =>
existT (fun H0 : nat => VectorDef.t A H0)
(S (projT1 l0)) (VectorDef.cons A h (projT1 l0) (projT2 l0)))
(fun y : {H0 : nat & t A H0} -> {H0 : nat & t A H0} =>
existT (fun H0 : nat => VectorDef.t A H0)
(S
(projT1
(appV_bad A (existT (fun H0 : nat => VectorDef.t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A)))))
(VectorDef.cons A h
(projT1
(appV_bad A (existT (fun H0 : nat => VectorDef.t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))
(projT2
(appV_bad A (existT (fun H0 : nat => VectorDef.t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))) =
y
(appV_bad A (existT (fun H0 : nat => VectorDef.t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A))))
eq_refl
(fun l0 : {H0 : nat & t A H0} =>
existT (fun H0 : nat => VectorDef.t A H0)
(S (projT1 l0)) (VectorDef.cons A h (projT1 l0) (projT2 l0)))
eq_refl)
(existT (fun H0 : nat => VectorDef.t A H0)
(S (projT1 (existT (fun H0 : nat => VectorDef.t A H0) n t0)))
(VectorDef.cons A h
(projT1 (existT (fun H0 : nat => VectorDef.t A H0) n t0))
(projT2 (existT (fun H0 : nat => VectorDef.t A H0) n t0))))
(List'.Coq_Init_Logic_f_equal {H0 : nat & t A H0}
{H0 : nat & t A H0}
(fun l0 : {H0 : nat & t A H0} =>
existT (fun H0 : nat => VectorDef.t A H0)
(S (projT1 l0)) (VectorDef.cons A h (projT1 l0) (projT2 l0)))
(appV_bad A (existT (fun H0 : nat => VectorDef.t A H0) n t0)
(existT (fun H0 : nat => t A H0) 0 (VectorDef.nil A)))
(existT (fun H0 : nat => VectorDef.t A H0) n t0) H))
(projT1 l) (projT2 l).
(* Let's break these down to find the error. *)
Definition id_eta {A : Type} (s : { H : nat & t A H }) : { H : nat & t A H} :=
existT (fun H : nat => t A H) (projT1 s) (projT2 s).
Definition nil {A : Type} :=
existT (fun H : nat => t A H) 0 (VectorDef.nil A).
Definition cons {A : Type} (a : A) (s : { H : nat & t A H }) : { H : nat & t A H} :=
existT _
(S (projT1 s))
(VectorDef.cons A a (projT1 s) (projT2 s)).
(*
* That gives us this term:
*)
Definition appV_nil_r_term_2 (A : Type) (l : {H : nat & t A H}) : id_eta (appV A (id_eta l) nil) = id_eta l :=
VectorDef.t_rect
A
(fun (n : nat) (t0 : VectorDef.t A n) =>
id_eta (appV A (existT _ n t0) nil) = existT _ n t0)
eq_refl
(fun (h : A) (n : nat) (t0 : VectorDef.t A n)
(H : id_eta (appV A (existT _ n t0) nil) = existT _ n t0) =>
eq_ind
(cons h (appV A (existT _ n t0) nil))
(fun y : {H0 : nat & t A H0} =>
cons h (appV A (existT _ n t0) nil) = id_eta y)
eq_refl
(cons h (existT _ n t0))
(eq_ind
(id_eta (appV A (existT _ n t0) nil))
(fun y : {H0 : nat & t A H0} => cons h (appV A (existT _ n t0) nil) = cons h y)
eq_refl
(existT _ n t0)
H))
(projT1 l)
(projT2 l).
(*
* Phew.
* In contrast, without identity, we get this:
*)
Fail Definition appV_nil_r_bad_2 (A : Type) (l : {H : nat & t A H}) : appV_bad A l nil = l :=
VectorDef.t_rect A
(fun (n : nat) (t0 : VectorDef.t A n) =>
appV_bad A (existT _ n t0) nil =
existT _ n t0)
eq_refl
(fun (h : A) (n : nat) (t0 : VectorDef.t A n)
(H : appV_bad A (existT _ n t0) nil = existT _ n t0) =>
eq_ind
(cons h (appV_bad A (existT _ n t0) nil))
(fun y : {H0 : nat & t A H0} =>
cons h (appV_bad A (existT _ n t0) nil) = y)
eq_refl
(cons h (existT _ n t0))
(eq_ind
(appV_bad A (existT _ n t0) nil)
(fun y0 : {H0 : nat & t A H0} => cons h (appV_bad A (existT _ n t0) nil) = cons h y0)
eq_refl
(existT _ n t0)
H))
(projT1 l)
(projT2 l).
(* But the actual type is this: *)
Definition appV_nil_r_bad_2 (A : Type) (l : {H : nat & t A H}) : appV_bad A (id_eta l) nil = id_eta l :=
VectorDef.t_rect A
(fun (n : nat) (t0 : VectorDef.t A n) =>
appV_bad A (existT _ n t0) nil =
existT _ n t0)
eq_refl
(fun (h : A) (n : nat) (t0 : VectorDef.t A n)
(H : appV_bad A (existT _ n t0) nil = existT _ n t0) =>
eq_ind
(cons h (appV_bad A (existT _ n t0) nil))
(fun y : {H0 : nat & t A H0} =>
cons h (appV_bad A (existT _ n t0) nil) = y)
eq_refl
(cons h (existT _ n t0))
(eq_ind
(appV_bad A (existT _ n t0) nil)
(fun y0 : {H0 : nat & t A H0} => cons h (appV_bad A (existT _ n t0) nil) = cons h y0)
eq_refl
(existT _ n t0)
H))
(projT1 l)
(projT2 l).
(*
* So in other words, without the id rule, the type of app_nil_r lifts to:
*
* appV_bad A l nil = l
*
* but the term of app_nil_r lifts to a term of type:
*
* appV_bad A (id_eta l) nil = id_eta l
*)
(*
* Why is this? It has to do with the type of our lifted eliminator:
*)
Definition vect_dep_elim (A: Type) (P : sigT (Vector.t A) -> Type) pnil (pcons : forall h s, P s -> P (cons h s)) s :=
Vector.t_rect
A
(fun n v => P (existT _ n v))
pnil
(fun t n (v : Vector.t A n) (IH : P (existT _ n v)) => pcons t (existT _ n v) IH)
(projT1 s)
(projT2 s).
(*
* So we have (P (projT1 s) (projT2 s)).
* When our motive is:
*)
Definition bad_motive (A : Type) (n : nat) (v : Vector.t A n) :=
appV_bad A (existT _ n v) nil =
existT _ n v.
(*
* applied to (projT1 l) (projT2 l), we get:
*)
Definition bad_motive_app (A : Type) (l : sigT (Vector.t A)) :=
appV_bad A (existT _ (projT1 l) (projT2 l)) nil =
existT _ (projT1 l) (projT2 l).
Print VectorDef.t_rect.
(* So: *)
(*
* P l := app A l nil = l
* Q n v := appV A (existT _ n v) nilV = existT _ n v
* Q (projT1 l) (projT2 l) := appV A (existT _ (projT1 l) (projT2 l)) nilV = existT _ (projT1 l) (projT2 l)
*)
(*
* Need that the type (P l) lifts to a type definitionally equal to (Q (projT1 l) (projT2 l)).
*)
(*
* We could succeed this way, though:
*)
Program Definition vect_dep_elim_2 (A : Type)
(P : sigT (Vector.t A) -> Type)
(f : P nil)
(f0 : forall (h : A) (s : sigT (Vector.t A)),
P s ->
P (existT _ (S (projT1 s)) (Vector.cons A h (projT1 s) (projT2 s))))
: forall (s : sigT (Vector.t A)), P s.
Proof.
intros. induction s. induction p.
- apply f.
- specialize (f0 h (existT _ n p)). apply f0. apply IHp.
Defined.
Definition appV_bad_2 (A : Type) (l m : {H : nat & t A H}) : { H : nat & t A H} :=
vect_dep_elim_2 A
(fun _ => {H : nat & t A H} -> {H : nat & t A H})
(fun m0 : {H : nat & t A H} => m0)
(fun (h : A) _ (H : {H : nat & t A H} -> {H : nat & t A H}) (m0 : {H0 : nat & t A H0}) =>
cons h (H m0))
l
m.
(* But then we get a problem here in a different place, notably since cons doesn't preserve the equality: *)
Fail Definition appV_nil_r_bad_3 (A : Type) (l : {H : nat & t A H}) : appV_bad_2 A l nil = l :=
vect_dep_elim_2 A
(fun (s : sigT (Vector.t A)) =>
appV_bad_2 A s nil = s)
eq_refl
(fun (h : A) (s : sigT (Vector.t A))
(H : appV_bad_2 A s nil = s) =>
eq_ind
(cons h (appV_bad_2 A s nil))
(fun y : {H0 : nat & t A H0} =>
cons h (appV_bad_2 A s nil) = y)
eq_refl
(cons h s)
(eq_ind
(appV_bad_2 A s nil)
(fun y0 : {H0 : nat & t A H0} => cons h (appV_bad_2 A s nil) = cons h y0)
eq_refl
s
H))
l.
Definition elim_id (A : Type) (s : {H : nat & t A H}) :=
vect_dep_elim
A
(fun _ => {H : nat & t A H})
nil
(fun (h : A) _ IH =>
cons h IH)
s.
Definition elim_id_2 (A : Type) (s : {H : nat & t A H}) :=
vect_dep_elim_2
A
(fun _ => {H : nat & t A H})
nil
(fun (h : A) _ IH =>
cons h IH)
s.
Fail Lemma foo:
forall A h s,
exists (H : cons h (elim_id_2 A s) = elim_id_2 A (cons h s)),
H = eq_refl.
Lemma bar:
forall A h s,
exists (H : cons h (elim_id A s) = elim_id A (cons h s)),
H = eq_refl.
Proof.
intros. exists (eq_refl (cons h (elim_id A s))). auto.
Defined.
Lemma elim_id_good_1 :
forall A l (f : forall (l : sigT (Vector.t A)), l = l),
vect_dep_elim A (fun l => l = l) (f nil) (fun t s _ => f (cons t s)) l = f (id_eta l).
Proof.
intros A l f. unfold vect_dep_elim. unfold id_eta. induction l. simpl.
induction p; reflexivity.
Defined.
Lemma elim_id_bad_good_1 :
forall A l (f : forall (l : sigT (Vector.t A)), l = l),
vect_dep_elim_2 A (fun l => l = l) (f nil) (fun t s _ => f (cons t s)) l = f l.
Proof.
intros A l f. unfold vect_dep_elim_2. induction l. simpl.
induction p; reflexivity.
Defined.
Lemma elim_id_good_2 :
forall A l (f : forall (l : sigT (Vector.t A)), l = l),
vect_dep_elim A (fun l => l = l) (f nil) (fun t s _ => f (cons t s)) l = f (id_eta l).
Proof.
intros A l f. unfold vect_dep_elim. unfold id_eta. induction l. simpl.
induction p; reflexivity.
Defined.
(* Failed to lift List'.app_nil_end
Failed to lift List'.app_eq_nil
Failed to lift List'.app_eq_unit
Failed to lift List'.app_inj_tail
Failed to lift List'.app_inv_head
Failed to lift List'.app_inv_tail
Failed to lift List'.app_removelast_last
Failed to lift List'.removelast_app*)