Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Raphaël Cauderlier
dklib
Commits
3c7505ed
Commit
3c7505ed
authored
Oct 29, 2013
by
Raphaël Cauderlier
Browse files
[dk_machine_int.dk] Adding cast operations from unary and binary natural numbers
parent
52eee85b
Changes
1
Hide whitespace changes
Inline
Side-by-side
dk_machine_int.dk
View file @
3c7505ed
...
...
@@ -131,3 +131,15 @@ signed_lt : N : UNat -> n : MInt N -> m : MInt N -> B
signed_gt : N : UNat -> n : MInt N -> m : MInt N -> B
:= N : UNat => n : MInt N => m : MInt N => dk_bool.not (signed_leq N m n).
(; Casting Peano natural numbers ;)
cast_peano : N : UNat -> n : UNat -> MInt N.
[ N : UNat ] cast_peano N UO --> zero N
[ N : UNat, n : UNat ] cast_peano N (US n) --> succ N (cast_peano N n).
(; Casting binary natural numbers ;)
#IMPORT dk_binary_nat
cast_bnat : N : UNat -> bn : dk_binary_nat.N -> MInt N.
[ N : UNat ] cast_bnat N dk_binary_nat.O --> zero N
[ bn : dk_binary_nat.N ] cast_bnat UO bn --> O.
[ N : UNat, bn : dk_binary_nat.N ] cast_bnat (US N) (dk_binary_nat.S0 bn) --> S0 N (cast_bnat N bn)
[ N : UNat, bn : dk_binary_nat.N ] cast_bnat (US N) (dk_binary_nat.S1 bn) --> S1 N (cast_bnat N bn).
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment