Casting int to nat in Isabelle

一笑奈何 提交于 2021-02-11 12:38:14

问题


How can I cast an int to nat in Isabelle when I'm sure that it is positive?

value "((-10)::int) mod 3"

for example gives 2 and if I'm correct any application of modulo on an int should result in a nat.

Unfortunately the type signature of modulo is 'a => 'a => 'a so I cannot fix 3 to a nat beforehand and the result will be an int.


回答1:


You can use value "nat (((-10)::int) mod 3)".



来源:https://stackoverflow.com/questions/57027062/casting-int-to-nat-in-isabelle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!