aboutsummaryrefslogtreecommitdiffhomepage
path: root/theories/Vectors
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2016-06-11 17:23:08 -0400
committerGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2016-09-26 23:43:27 +0200
commit7bc04ff2cc9d511c4b8552a3e5f9ad416917fb95 (patch)
treeceaa93e8a4ef67ee16202f840efdb2429d18af67 /theories/Vectors
parent0658ba7b908dad946200f872f44260d0e4893a94 (diff)
Fix bug #4785 (use [ ] for vector nil)
Also delimit vector_scope with vector, so that people can write %vector without having to delimit it themselves.
Diffstat (limited to 'theories/Vectors')
-rw-r--r--theories/Vectors/VectorDef.v7
1 files changed, 4 insertions, 3 deletions
diff --git a/theories/Vectors/VectorDef.v b/theories/Vectors/VectorDef.v
index c69223804..095cda398 100644
--- a/theories/Vectors/VectorDef.v
+++ b/theories/Vectors/VectorDef.v
@@ -30,7 +30,7 @@ Inductive t A : nat -> Type :=
|nil : t A 0
|cons : forall (h:A) (n:nat), t A n -> t A (S n).
-Local Notation "[]" := (nil _).
+Local Notation " [ ] " := (nil _) (format "[ ]").
Local Notation "h :: t" := (cons _ h _ t) (at level 60, right associativity).
Section SCHEMES.
@@ -102,7 +102,7 @@ Definition const {A} (a:A) := nat_rect _ [] (fun n x => cons _ a n x).
Computational behavior of this function should be the same as
ocaml function. *)
-Definition nth {A} :=
+Definition nth {A} :=
fix nth_fix {m} (v' : t A m) (p : Fin.t m) {struct v'} : A :=
match p in Fin.t m' return t A m' -> A with
|Fin.F1 => caseS (fun n v' => A) (fun h n t => h)
@@ -293,7 +293,8 @@ Eval cbv delta beta in fold_right (fun h H => Datatypes.cons h H) v Datatypes.ni
End VECTORLIST.
Module VectorNotations.
-Notation "[]" := [] : vector_scope.
+Delimit Scope vector_scope with vector.
+Notation " [ ] " := [] (format "[ ]") : vector_scope.
Notation "h :: t" := (h :: t) (at level 60, right associativity)
: vector_scope.
Notation " [ x ] " := (x :: []) : vector_scope.