Skip to content

Commit aa6b01b

Browse files
committed
concise rev_cons
1 parent 730304c commit aa6b01b

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

theories/Vectors/VectorSpec.v

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -545,16 +545,6 @@ intros P a n v. induction v as [|b n v IH].
545545
- cbn. rewrite !Forall_cons_iff. tauto.
546546
Qed.
547547

548-
Lemma rev_append_tail_shiftin A : forall a n (v : t A n) m (w : t A m) k
549-
(E1 : Nat.tail_add n m = k) (E2 : Nat.tail_add n (S m) = S k),
550-
rew [t A] E2 in rev_append_tail v (shiftin a w) =
551-
shiftin a (rew [t A] E1 in rev_append_tail v w).
552-
Proof.
553-
intros a n v. induction v as [|b n v IH]; intros m w k E1 E2; cbn.
554-
- subst k. now rewrite (UIP_refl_nat _ E2).
555-
- apply (IH _ (b :: w)).
556-
Qed.
557-
558548
(** ** Properties of [rev] *)
559549

560550
Lemma rev_nil A: rev (nil A) = [].
@@ -567,7 +557,12 @@ Lemma rev_cons A: forall a n (v : t A n), rev (a :: v) = shiftin a (rev v).
567557
Proof.
568558
intros a n v. unfold rev, rev_append, eq_rect_r.
569559
rewrite !rew_compose.
570-
apply (rev_append_tail_shiftin A a n v 0 []).
560+
enough (H : forall m (w : t A m) k (E1 : _ = k) E2,
561+
rew [t A] E2 in rev_append_tail v (shiftin a w) =
562+
shiftin a (rew [t A] E1 in rev_append_tail v w)) by apply (H 0 []).
563+
induction v as [|b n v IH]; intros m w k E1 E2; cbn.
564+
- subst k. now rewrite (UIP_refl_nat _ E2).
565+
- apply (IH _ (b :: w)).
571566
Qed.
572567

573568
Lemma rev_shiftin A: forall a n (v : t A n),

0 commit comments

Comments
 (0)