Skip to content

Commit

Permalink
Backporting the legacy Coq Stream library.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppedrot committed Jun 28, 2018
1 parent 5b5cc7e commit 09ed44d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ FLOCQ=\

# General-purpose libraries (in lib/)

VLIB=Axioms.v Coqlib.v Intv.v Maps.v Heaps.v Lattice.v Ordered.v \
VLIB=Axioms.v Coqlib.v Streams.v Intv.v Maps.v Heaps.v Lattice.v Ordered.v \
Iteration.v Integers.v Archi.v Fappli_IEEE_extra.v Floats.v \
Parmov.v UnionFind.v Wfsimpl.v \
Postorder.v FSetAVLplus.v IntvSets.v Decidableplus.v BoolEqual.v
Expand Down
31 changes: 31 additions & 0 deletions lib/Streams.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
(* *********************************************************************)
(* *)
(* The Compcert verified compiler *)
(* *)
(* Xavier Leroy, INRIA Paris-Rocquencourt *)
(* *)
(* Copyright Institut National de Recherche en Informatique et en *)
(* Automatique. All rights reserved. This file is distributed *)
(* under the terms of the GNU General Public License as published by *)
(* the Free Software Foundation, either version 2 of the License, or *)
(* (at your option) any later version. This file is also distributed *)
(* under the terms of the INRIA Non-Commercial License Agreement. *)
(* *)
(* *********************************************************************)

Set Implicit Arguments.

CoInductive Stream (A : Type) : Type :=
Cons : A -> Stream A -> Stream A.

Definition hd (A : Type) (x:Stream A) := match x with
| Cons a _ => a
end.

Definition tl (A : Type) (x:Stream A) := match x with
| Cons _ s => s
end.

CoFixpoint const (A : Type) (a : A) : Stream A := Cons a (const a).

Unset Implicit Arguments.

0 comments on commit 09ed44d

Please sign in to comment.