playground/coq/unfinished/stack.v

25 lines
520 B
Coq

Require Import Vector.
Import VectorNotations.
Check Vector.t nat 3.
Check Vector.nil.
Print t.
Inductive stack {A:Type} (n:nat) : Type :=
| stnil : Vector.t A 0 -> stack n
| stcons : forall n':nat,
n' < n -> Vector.t A n' -> stack n.
Compute stnil 2 (Vector.nil nat).
Compute stcons stnil 2 (Vector.nil nat).
Compute (stcons 3 (stnil)).
Section stack.
(* stack of size [n] whose elements are of type [A] *)
Definition stack (A:Type) (n:nat): Type := Vector.t A n.
Check [1;2] : stack nat 2.
End stack.