-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backporting the legacy Coq Stream library.
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |