Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backporting the legacy Coq Stream library. #231

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.