@@ -24,9 +24,14 @@ Definition cons_inj {A} {a1 a2} {n} {v1 v2 : t A n}
2424 with | eq_refl => conj eq_refl eq_refl
2525 end .
2626
27+ Lemma nil_spec {A} (v : t A 0) : v = [].
28+ Proof .
29+ apply (fun P E => case0 P E v). reflexivity.
30+ Defined .
31+
2732Lemma eta {A} {n} (v : t A (S n)) : v = hd v :: tl v.
2833Proof .
29- intros; apply (fun P IS => caseS P IS (n := n) v); intros; reflexivity.
34+ apply (fun P IS => caseS P IS (n := n) v); intros; reflexivity.
3035Defined .
3136
3237(** Lemmas are done for functions that use [Fin.t] but thanks to [Peano_dec.le_unique], all
@@ -103,17 +108,18 @@ Qed.
103108Lemma nth_replace_eq A: forall n p (v : t A n) a,
104109 nth (replace v p a) p = a.
105110Proof .
106- intros n p v a. induction v; pattern p .
107- - apply Fin.case0.
108- - now apply Fin.caseS'.
111+ intros n p v a. induction v.
112+ - now apply Fin.case0.
113+ - now apply ( Fin.caseS' p) .
109114Qed .
110115
111116Lemma nth_replace_neq A: forall n p q, p <> q -> forall (v : t A n) a,
112117 nth (replace v q a) p = nth v p.
113118Proof .
114- intros n p q Hpq v a. induction v as [|b n v IH]; revert Hpq; pattern p.
115- - apply Fin.case0.
116- - apply Fin.caseS'; pattern q; apply Fin.caseS'; [easy..|].
119+ intros n p q Hpq v a.
120+ induction v as [|b n v IH]; revert Hpq.
121+ - now apply Fin.case0.
122+ - apply (Fin.caseS' p); apply (Fin.caseS' q); [easy..|].
117123 intros ???. apply IH. intros ?. now subst.
118124Qed .
119125
@@ -171,7 +177,7 @@ Lemma replace_append_L A: forall n m (v : t A n) (w : t A m) p a,
171177 replace (v ++ w) (Fin.L m p) a = (replace v p a) ++ w.
172178Proof .
173179intros n m v w p a. induction v as [|b n v IH].
174- - pattern p. apply Fin.case0.
180+ - now apply Fin.case0.
175181- apply (Fin.caseS' p).
176182 + reflexivity.
177183 + intros p'. cbn. apply f_equal, IH.
@@ -256,9 +262,10 @@ Qed.
256262Lemma map2_ext A B C: forall (f g:A->B->C), (forall a b, f a b = g a b) ->
257263 forall n (v : t A n) (w : t B n), map2 f v w = map2 g v w.
258264Proof .
259- intros f g Hfg n v w. pattern n, v, w. apply rect2.
265+ intros f g Hfg n v w.
266+ apply (fun P H1 H2 => rect2 P H1 H2 v w).
260267- reflexivity.
261- - cbn. congruence .
268+ - cbn. intros ??? IH ??. now rewrite IH, Hfg .
262269Qed .
263270
264271(** ** Properties of [fold_left] *)
@@ -448,7 +455,7 @@ intros P n v1 v2. split.
448455- intros H. induction H.
449456 + apply Fin.case0.
450457 + intros p. now apply (Fin.caseS' p).
451- - pattern n, v1, v2. apply rect2.
458+ - apply (fun P H1 H2 => rect2 P H1 H2 v1 v2) .
452459 + constructor.
453460 + intros ??? IH ?? H. constructor.
454461 * apply (H Fin.F1).
0 commit comments