Skip to content

Commit b0b727b

Browse files
committed
Add more definitions for Stdlib
1 parent 4becb8c commit b0b727b

File tree

7 files changed

+331
-9
lines changed

7 files changed

+331
-9
lines changed

proofs/Basics.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ Definition int64 := Z.
105105

106106
Definition nativeint := Z.
107107

108+
Definition char := ascii.
109+
108110
Definition bytes := string.
109111

110112
Definition try {A : Set} (x : A) : A := x.

proofs/Stdlib.v

Lines changed: 322 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,339 @@ Parameter lsr : int -> int -> int.
133133
Parameter asr : int -> int -> int.
134134

135135
(** * Floating-point arithmetic *)
136+
Parameter op_tildeminuspoint : float -> float.
136137

138+
Parameter op_tildepluspoint : float -> float.
139+
140+
Parameter op_pluspoint : float -> float -> float.
141+
142+
Parameter op_minuspoint : float -> float -> float.
143+
144+
Parameter op_timespoint : float -> float -> float.
145+
146+
Parameter op_divpoint : float -> float -> float.
147+
148+
Parameter op_timestimespoint : float -> float -> float.
149+
150+
Parameter sqrt : float -> float.
151+
152+
Parameter exp : float -> float.
153+
154+
Parameter log : float -> float.
155+
156+
Parameter log10 : float -> float.
157+
158+
Parameter expm1 : float -> float.
159+
160+
Parameter log1p : float -> float.
161+
162+
Parameter cos : float -> float.
163+
164+
Parameter sin : float -> float.
165+
166+
Parameter tan : float -> float.
167+
168+
Parameter acos : float -> float.
169+
170+
Parameter asin : float -> float.
171+
172+
Parameter atan : float -> float.
173+
174+
Parameter atan2 : float -> float -> float.
175+
176+
Parameter hypot : float -> float -> float.
177+
178+
Parameter cosh : float -> float.
179+
180+
Parameter sinh : float -> float.
181+
182+
Parameter tanh : float -> float.
183+
184+
Parameter acosh : float -> float.
185+
186+
Parameter asinh : float -> float.
187+
188+
Parameter atanh : float -> float.
189+
190+
Parameter ceil : float -> float.
191+
192+
Parameter floor : float -> float.
193+
194+
Parameter abs_float : float -> float.
195+
196+
Parameter copysign : float -> float -> float.
197+
198+
Parameter mod_float : float -> float -> float.
199+
200+
Parameter frexp : float -> float * int.
201+
202+
Parameter ldexp : float -> int -> float.
203+
204+
Parameter modf : float -> float * float.
205+
206+
Parameter float_value : int -> float.
207+
208+
Parameter float_of_int : int -> float.
209+
210+
Parameter truncate : float -> int.
211+
212+
Parameter int_of_float : float -> int.
213+
214+
Parameter infinity : float.
215+
216+
Parameter neg_infinity : float.
217+
218+
Parameter nan : float.
219+
220+
Parameter max_float : float.
221+
222+
Parameter min_float : float.
223+
224+
Parameter epsilon_float : float.
225+
226+
Inductive fpclass : Set :=
227+
| FP_normal
228+
| FP_subnormal
229+
| FP_zero
230+
| FP_infinite
231+
| FP_nan.
232+
233+
Parameter classify_float : float -> fpclass.
137234

138235
(** * String operations *)
236+
Parameter op_caret : string -> string -> string.
237+
139238
(** * Character operations *)
239+
Parameter int_of_char : char -> int.
240+
241+
Parameter char_of_int : int -> char.
242+
140243
(** * Unit operations *)
244+
Definition ignore {a : Set} (_ : a) : unit :=
245+
tt.
246+
141247
(** * String conversion functions *)
248+
Parameter string_of_bool : bool -> string.
249+
250+
Parameter bool_of_string_opt : string -> option bool.
251+
252+
Parameter bool_of_string : string -> bool.
253+
254+
Parameter string_of_int : int -> string.
255+
256+
Parameter int_of_string_opt : string -> option int.
257+
258+
Parameter int_of_string : string -> int.
259+
260+
Parameter string_of_float : float -> string.
261+
262+
Parameter float_of_string_opt : string -> option float.
263+
264+
Parameter float_of_string : string -> float.
265+
142266
(** * Pair operations *)
267+
Parameter fst : forall {a b : Set}, a * b -> a.
268+
269+
Parameter snd : forall {a b : Set}, a * b -> b.
270+
143271
(** * List operations *)
272+
Parameter op_at : forall {a : Set}, list a -> list a -> list a.
273+
144274
(** * Input/output *)
275+
Parameter in_channel : Set.
276+
277+
Parameter out_channel : Set.
278+
279+
Parameter stdin : in_channel.
280+
281+
Parameter stdout : out_channel.
282+
283+
Parameter stderr : out_channel.
284+
285+
(** ** Output functions on standard output *)
286+
Parameter print_char : char -> unit.
287+
288+
Parameter print_string : string -> unit.
289+
290+
Parameter print_bytes : bytes -> unit.
291+
292+
Parameter print_int : int -> unit.
293+
294+
Parameter print_float : float -> unit.
295+
296+
Parameter print_endline : string -> unit.
297+
298+
Parameter print_newline : unit -> unit.
299+
300+
(** ** Output functions on standard error *)
301+
Parameter prerr_char : char -> unit.
302+
303+
Parameter prerr_string : string -> unit.
304+
305+
Parameter prerr_bytes : bytes -> unit.
306+
307+
Parameter prerr_int : int -> unit.
308+
309+
Parameter prerr_float : float -> unit.
310+
311+
Parameter prerr_endline : string -> unit.
312+
313+
Parameter prerr_newline : unit -> unit.
314+
315+
(** ** Input functions on standard input *)
316+
Parameter read_line : unit -> string.
317+
318+
Parameter read_int_opt : unit -> option int.
319+
320+
Parameter read_int : unit -> int.
321+
322+
Parameter read_float_opt : unit -> option float.
323+
324+
Parameter read_float : unit -> float.
325+
326+
(** ** General output functions *)
327+
Inductive open_flag : Set :=
328+
| Open_rdonly
329+
| Open_wronly
330+
| Open_append
331+
| Open_creat
332+
| Open_trunc
333+
| Open_excl
334+
| Open_binary
335+
| Open_text
336+
| Open_nonblock.
337+
338+
Parameter open_out : string -> out_channel.
339+
340+
Parameter open_out_bin : string -> out_channel.
341+
342+
Parameter open_out_gen : list open_flag -> int -> string -> out_channel.
343+
344+
Parameter flush : out_channel -> unit.
345+
346+
Parameter flush_all : unit -> unit.
347+
348+
Parameter output_char : out_channel -> char -> unit.
349+
350+
Parameter output_string : out_channel -> string -> unit.
351+
352+
Parameter output_bytes : out_channel -> bytes -> unit.
353+
354+
Parameter output : out_channel -> bytes -> int -> int -> unit.
355+
356+
Parameter output_substring : out_channel -> string -> int -> int -> unit.
357+
358+
Parameter output_byte : out_channel -> int -> unit.
359+
360+
Parameter output_binary_int : out_channel -> int -> unit.
361+
362+
Parameter output_value : forall {a : Set}, out_channel -> a -> unit.
363+
364+
Parameter seek_out : out_channel -> int -> unit.
365+
366+
Parameter pos_out : out_channel -> int.
367+
368+
Parameter out_channel_length : out_channel -> int.
369+
370+
Parameter close_out : out_channel -> unit.
371+
372+
Parameter close_out_noerr : out_channel -> unit.
373+
374+
Parameter set_binary_mode_out : out_channel -> bool -> unit.
375+
376+
(** ** General input functions *)
377+
Parameter open_in : string -> in_channel.
378+
379+
Parameter open_in_bin : string -> in_channel.
380+
381+
Parameter open_in_gen : list open_flag -> int -> string -> in_channel.
382+
383+
Parameter input_char : in_channel -> char.
384+
385+
Parameter input_line : in_channel -> string.
386+
387+
Parameter input : in_channel -> bytes -> int -> int -> int.
388+
389+
Parameter really_input : in_channel -> bytes -> int -> int -> unit.
390+
391+
Parameter really_input_string : in_channel -> int -> string.
392+
393+
Parameter input_byte : in_channel -> int.
394+
395+
Parameter input_binary_int : in_channel -> int.
396+
397+
Parameter input_value : forall {a : Set}, in_channel -> a.
398+
399+
Parameter seek_in : in_channel -> int -> unit.
400+
401+
Parameter pos_in : in_channel -> int.
402+
403+
Parameter in_channel_length : in_channel -> int.
404+
405+
Parameter close_in : in_channel -> unit.
406+
407+
Parameter close_in_noerr : in_channel -> unit.
408+
409+
Parameter set_binary_mode_in : in_channel -> bool -> unit.
410+
411+
(** ** Operations on large files *)
412+
Module LargeFile.
413+
Parameter seek_out : out_channel -> int64 -> unit.
414+
415+
Parameter pos_out : out_channel -> int64.
416+
417+
Parameter out_channel_length : out_channel -> int64.
418+
419+
Parameter seek_in : in_channel -> int64 -> unit.
420+
421+
Parameter pos_in : in_channel -> int64.
422+
423+
Parameter in_channel_length : in_channel -> int64.
424+
End LargeFile.
425+
145426
(** * References *)
427+
Record ref {a : Set} : Set := {
428+
contents : a;
429+
}.
430+
Arguments ref : clear implicits.
431+
432+
Parameter ref_value : forall {a : Set}, a -> ref a.
433+
434+
Parameter op_exclamation : forall {a : Set}, ref a -> a.
435+
436+
Parameter op_coloneq : forall {a : Set}, ref a -> a -> unit.
437+
438+
Parameter incr : ref int -> unit.
439+
440+
Parameter decr : ref int -> unit.
441+
146442
(** * Result type *)
443+
Inductive result (a b : Set) : Set :=
444+
| Ok : a -> result a b
445+
| Error : b -> result a b.
446+
Arguments Ok {_}.
447+
Arguments Error {_}.
448+
147449
(** * Operations on format strings *)
450+
Definition format6 : Set -> Set -> Set -> Set -> Set -> Set -> Set :=
451+
CamlinternalFormatBasics.format6.
452+
453+
Definition format4 (a b c d : Set) : Set := format6 a b c c c d.
454+
455+
Definition format (a b c : Set) : Set := format4 a b c c.
456+
457+
Parameter string_of_format : forall {a b c d e f : Set},
458+
format6 a b c d e f -> string.
459+
460+
Parameter format_of_string : forall {a b c d e f : Set},
461+
format6 a b c d e f -> format6 a b c d e f.
462+
463+
Parameter op_caretcaret : forall {a b c d e f g h : Set},
464+
format6 a b c d e f -> format6 f b c e g h -> format6 a b c d g h.
465+
148466
(** * Program termination *)
467+
Parameter exit : forall {a : Set}, int -> a.
468+
469+
Parameter at_exit : (unit -> unit) -> unit.
470+
149471
(** * Standard library modules *)

src/configurationRenaming.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
let rules =
22
[
33
(* Built-in types *)
4-
("char", "ascii");
54
("()", "tt");
65
("op_coloncolon", "cons");
76
("Ok", "inl");
87
("Error", "inr");
9-
("exn", "extensible_type");
108
(* Predefined exceptions *)
119
("Match_failure", "CoqOfOCaml.Match_failure");
1210
("Assert_failure", "CoqOfOCaml.Assert_failure");

tests/builtin_types.v

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ Require Import CoqOfOCaml.Settings.
33

44
Definition n : int := 12.
55

6-
Definition c1 : ascii := "a" % char.
6+
Definition c1 : char := "a" % char.
77

8-
Definition c2 : ascii := "010" % char.
8+
Definition c2 : char := "010" % char.
99

10-
Definition c3 : ascii := "009" % char.
10+
Definition c3 : char := "009" % char.
1111

12-
Definition c4 : ascii := """" % char.
12+
Definition c4 : char := """" % char.
1313

1414
Definition s : string := "hi\n\t:)\""".
1515

tests/functor.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Parameter Make :
3232
forall {P_t : Set},
3333
forall (P : COMPARABLE (t := P_t)), S (t := P.(COMPARABLE.t)).
3434

35-
Parameter Char : S (t := ascii).
35+
Parameter Char : S (t := char).
3636

3737
Parameter Abstract_t : Set.
3838

tests/pre_defined_types.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Definition o1 {A : Set} : option A := None.
1313

1414
Definition o2 : option int := Some 12.
1515

16-
Definition c : ascii := "g" % char.
16+
Definition c : char := "g" % char.
1717

1818
Definition s1 : string := "bla".
1919

0 commit comments

Comments
 (0)