-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
107 changed files
with
3,786 additions
and
1,922 deletions.
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
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
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
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,30 @@ | ||
let rec pos_of_z z = | ||
let open Z.Compare in | ||
if z <= Z.one then BinNums.Coq_xH | ||
else | ||
let p = pos_of_z (Z.shift_right z 1) in | ||
if (Z.erem z (Z.of_int 2)) = Z.one | ||
then BinNums.Coq_xI p | ||
else BinNums.Coq_xO p | ||
|
||
let rec z_of_pos pos = | ||
let open Z in | ||
match pos with | ||
| BinNums.Coq_xH -> Z.one | ||
| BinNums.Coq_xO p -> Z.shift_left (z_of_pos p) 1 | ||
| BinNums.Coq_xI p -> Z.shift_left (z_of_pos p) 1 + Z.one | ||
|
||
let cz_of_z z = | ||
let open Z.Compare in | ||
if z = Z.zero then BinNums.Z0 | ||
else if z < Z.zero then BinNums.Zneg (pos_of_z (Z.abs z)) | ||
else BinNums.Zpos (pos_of_z z) | ||
|
||
let z_of_cz z = | ||
match z with | ||
| BinNums.Zneg p -> Z.neg (z_of_pos p) | ||
| BinNums.Z0 -> Z.zero | ||
| BinNums.Zpos p -> z_of_pos p | ||
|
||
let cz_of_int i = cz_of_z (Z.of_int i) | ||
let int_of_cz z = Z.to_int (z_of_cz z) |
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
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
Oops, something went wrong.