Skip to content

Commit 008cb5b

Browse files
committed
Stdlib: beginning of Stdlib.v file
1 parent 9c664eb commit 008cb5b

File tree

3 files changed

+152
-0
lines changed

3 files changed

+152
-0
lines changed

proofs/Basics.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ Axiom Set_oracle_invoke
101101
: forall {name : string} (A : Set),
102102
Set_oracle name = A.
103103

104+
Parameter exn : Set.
105+
104106
Definition int := Z.
105107

106108
Definition float := Z.

proofs/Stdlib.v

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
Require Import Strings.String.
2+
Require Import ZArith.
3+
Require Import CoqOfOCaml.Basics.
4+
5+
Local Open Scope Z_scope.
6+
7+
(** * Exceptions *)
8+
Parameter raise : forall {a : Set}, exn -> a.
9+
10+
Parameter raise_notrace : forall {a : Set}, exn -> a.
11+
12+
Parameter invaliv_arg : forall {a : Set}, string -> a.
13+
14+
Parameter failwith : forall {a : Set}, string -> a.
15+
16+
Parameter Exit : exn.
17+
18+
Parameter Match_failure : string * int * int -> exn.
19+
20+
Parameter Assert_failure : string * int * int -> exn.
21+
22+
Parameter Invalid_argument : string -> exn.
23+
24+
Parameter Failure : string -> exn.
25+
26+
Parameter Not_found : exn.
27+
28+
Parameter Out_of_memory : exn.
29+
30+
Parameter Stack_overflow : exn.
31+
32+
Parameter Sys_error : string -> exn.
33+
34+
Parameter End_of_file : exn.
35+
36+
Parameter Division_by_zero : exn.
37+
38+
Parameter Sys_blocked_io : exn.
39+
40+
Parameter Undefined_recursive_module : string * int * int -> exn.
41+
42+
(** * Comparisons *)
43+
Parameter op_eq : forall {a : Set}, a -> a -> bool.
44+
45+
Parameter op_ltgt : forall {a : Set}, a -> a -> bool.
46+
47+
Parameter op_lt : forall {a : Set}, a -> a -> bool.
48+
49+
Parameter op_gt : forall {a : Set}, a -> a -> bool.
50+
51+
Parameter op_lteq : forall {a : Set}, a -> a -> bool.
52+
53+
Parameter op_gteq : forall {a : Set}, a -> a -> bool.
54+
55+
Parameter compare : forall {a : Set}, a -> a -> int.
56+
57+
Parameter min : forall {a : Set}, a -> a -> a.
58+
59+
Parameter max : forall {a : Set}, a -> a -> a.
60+
61+
Parameter op_eqeq : forall {a : Set}, a -> a -> bool.
62+
63+
Parameter op_exclamationeq : forall {a : Set}, a -> a -> bool.
64+
65+
(** * Boolean operations *)
66+
Definition not : bool -> bool := negb.
67+
68+
Definition op_andand : bool -> bool -> bool := andb.
69+
70+
Definition op_pipepipe : bool -> bool -> bool := orb.
71+
72+
(** * Debugging *)
73+
Parameter __LOC__ : string.
74+
75+
Parameter __FILE__ : string.
76+
77+
Parameter __LINE__ : int.
78+
79+
Parameter __MODULE__ : string.
80+
81+
Parameter __POS__ : string * int * int * int.
82+
83+
Parameter __FUNCTION__ : string.
84+
85+
Parameter __LOC_OF__ : forall {a : Set}, a -> string * a.
86+
87+
Parameter __LINE_OF__ : forall {a : Set}, a -> int * a.
88+
89+
Parameter __POS_OF__ : forall {a : Set}, a -> (string * int * int * int) * a.
90+
91+
(** * Composition operators *)
92+
(* `coq-of-ocaml` should unfold these operators to generate a cleaner output. *)
93+
94+
(** * Integer arithmetic *)
95+
Parameter op_tildeminus : int -> int.
96+
97+
Parameter op_tildeplus : int -> int.
98+
99+
Definition succ (n : int) : int :=
100+
n + 1.
101+
102+
Definition pred (n : int) : int :=
103+
n - 1.
104+
105+
Definition op_plus : int -> int -> int := Z.add.
106+
107+
Definition op_minus : int -> int -> int := Z.sub.
108+
109+
Definition op_times : int -> int -> int := Z.mul.
110+
111+
Parameter op_div : int -> int -> int.
112+
113+
Definition _mod : int -> int -> int := Z.rem.
114+
115+
Definition abs : int -> int := Z.abs.
116+
117+
Definition max_int : int := 4611686018427387903.
118+
119+
Definition min_int : int := -4611686018427387904.
120+
121+
Parameter land : int -> int -> int.
122+
123+
Parameter lor : int -> int -> int.
124+
125+
Parameter lxor : int -> int -> int.
126+
127+
Parameter lnot : int -> int.
128+
129+
Parameter lsl : int -> int -> int.
130+
131+
Parameter lsr : int -> int -> int.
132+
133+
Parameter asr : int -> int -> int.
134+
135+
(** * Floating-point arithmetic *)
136+
137+
138+
(** * String operations *)
139+
(** * Character operations *)
140+
(** * Unit operations *)
141+
(** * String conversion functions *)
142+
(** * Pair operations *)
143+
(** * List operations *)
144+
(** * Input/output *)
145+
(** * References *)
146+
(** * Result type *)
147+
(** * Operations on format strings *)
148+
(** * Program termination *)
149+
(** * Standard library modules *)

proofs/_CoqProject

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ CoqOfOCaml.v
66
Libraries.v
77
List.v
88
Settings.v
9+
Stdlib.v
910
Tags.v

0 commit comments

Comments
 (0)