| 1 |
(************************************************************************) |
| 2 |
(* * The Rocq Prover / The Rocq Development Team *) |
| 3 |
(* v * Copyright INRIA, CNRS and contributors *) |
| 4 |
(* <O___,, * (see version control and CREDITS file for authors & dates) *) |
| 5 |
(* \VV/ **************************************************************) |
| 6 |
(* // * This file is distributed under the terms of the *) |
| 7 |
(* * GNU Lesser General Public License Version 2.1 *) |
| 8 |
(* * (see LICENSE file for the text of the license) *) |
| 9 |
(************************************************************************) |
| 10 |
|
| 11 |
Require Export CarryType. |
| 12 |
|
| 13 |
Register bool as kernel.ind_bool. |
| 14 |
Register prod as kernel.ind_pair. |
| 15 |
Register carry as kernel.ind_carry. |
| 16 |
Register comparison as kernel.ind_cmp. |
| 17 |
|
| 18 |
Primitive int := #int63_type. |
| 19 |
Register int as num.int63.type. |
| 20 |
Variant pos_neg_int63 := Pos (d:int) | Neg (d:int). |
| 21 |
Register pos_neg_int63 as num.int63.pos_neg_int63. |
| 22 |
Declare Scope uint63_scope. |
| 23 |
Definition id_int : int -> int := fun x => x. |
| 24 |
Record int_wrapper := wrap_int {int_wrap : int}. |
| 25 |
Register int_wrapper as num.int63.int_wrapper. |
| 26 |
Register wrap_int as num.int63.wrap_int. |
| 27 |
Definition printer (x : int_wrapper) : pos_neg_int63 := Pos (int_wrap x). |
| 28 |
Definition parser (x : pos_neg_int63) : option int := |
| 29 |
match x with |
| 30 |
| Pos p => Some p |
| 31 |
| Neg _ => None |
| 32 |
end. |
| 33 |
|
| 34 |
|
| 35 |
Declare Scope int63_scope. |
| 36 |
Module Import Int63NotationsInternalA. |
| 37 |
Delimit Scope int63_scope with int63. |
| 38 |
End Int63NotationsInternalA. |
| 39 |
Number Notation int parser printer : int63_scope. |
| 40 |
|
| 41 |
Module Import Uint63NotationsInternalA. |
| 42 |
Delimit Scope uint63_scope with uint63. |
| 43 |
Bind Scope uint63_scope with int. |
| 44 |
End Uint63NotationsInternalA. |
| 45 |
Number Notation int parser printer : uint63_scope. |
| 46 |
|
| 47 |
|
| 48 |
(* Logical operations *) |
| 49 |
Primitive lsl := #int63_lsl. |
| 50 |
|
| 51 |
Primitive lsr := #int63_lsr. |
| 52 |
|
| 53 |
Primitive land := #int63_land. |
| 54 |
|
| 55 |
Primitive lor := #int63_lor. |
| 56 |
|
| 57 |
Primitive lxor := #int63_lxor. |
| 58 |
|
| 59 |
|
| 60 |
Primitive asr := #int63_asr. |
| 61 |
|
| 62 |
(* Arithmetic modulo operations *) |
| 63 |
Primitive add := #int63_add. |
| 64 |
|
| 65 |
Primitive sub := #int63_sub. |
| 66 |
|
| 67 |
Primitive mul := #int63_mul. |
| 68 |
|
| 69 |
Primitive mulc := #int63_mulc. |
| 70 |
|
| 71 |
Primitive div := #int63_div. |
| 72 |
|
| 73 |
Primitive mod := #int63_mod. |
| 74 |
|
| 75 |
Primitive divs := #int63_divs. |
| 76 |
|
| 77 |
Primitive mods := #int63_mods. |
| 78 |
|
| 79 |
(* Comparisons *) |
| 80 |
Primitive eqb := #int63_eq. |
| 81 |
Register eqb as num.int63.eqb. |
| 82 |
|
| 83 |
Primitive ltb := #int63_lt. |
| 84 |
|
| 85 |
Primitive leb := #int63_le. |
| 86 |
|
| 87 |
Primitive ltsb := #int63_lts. |
| 88 |
|
| 89 |
Primitive lesb := #int63_les. |
| 90 |
|
| 91 |
(** Exact arithmetic operations *) |
| 92 |
|
| 93 |
Primitive addc := #int63_addc. |
| 94 |
|
| 95 |
Primitive addcarryc := #int63_addcarryc. |
| 96 |
|
| 97 |
Primitive subc := #int63_subc. |
| 98 |
|
| 99 |
Primitive subcarryc := #int63_subcarryc. |
| 100 |
|
| 101 |
Primitive diveucl := #int63_diveucl. |
| 102 |
|
| 103 |
Primitive diveucl_21 := #int63_div21. |
| 104 |
|
| 105 |
Primitive addmuldiv := #int63_addmuldiv. |
| 106 |
|
| 107 |
(** Comparison *) |
| 108 |
Primitive compare := #int63_compare. |
| 109 |
|
| 110 |
Primitive compares := #int63_compares. |
| 111 |
|
| 112 |
(** Exotic operations *) |
| 113 |
|
| 114 |
Primitive head0 := #int63_head0. |
| 115 |
Primitive tail0 := #int63_tail0. |
| 116 |
|
| 117 |
Module Export PrimInt63Notations. |
| 118 |
Export Int63NotationsInternalA. |
| 119 |
Export Uint63NotationsInternalA. |
| 120 |
End PrimInt63Notations. |