[英]How does one define a if then else expression in Isabelle?
It complains to me I have a parsing error but I can't find in the manual what the right syntax is suppose to be...它向我抱怨我有一个解析错误,但我在手册中找不到正确的语法应该是什么......
| "my_function x b (Cons3 y) = if x=y then b else (Cons3 y)"
error:错误:
Inner syntax error⌂
Failed to parse prop
You need brackets:你需要括号:
| "my_function x b (Cons3 y) = (if x=y then b else (Cons3 y) )"
for some reason.因为某些原因。
Found an example and copied it from this resource:找到一个例子并从这个资源中复制它:
https://isabelle.in.tum.de/doc/functions.pdf https://isabelle.in.tum.de/doc/functions.pdf
In the HOL object logic, the if-then-else
, case
, and let
constructs have as low a precedence as quantifiers, which requires additional enclosing parentheses in the context of most other operations.在 HOL 对象逻辑中, if-then-else
、 case
和let
结构的优先级与量词一样低,这在大多数其他操作的上下文中需要额外的括号。 Please have a look at https://isabelle.in.tum.de/dist/Isabelle2019/doc/logics.pdf , page 10.请查看https://isabelle.in.tum.de/dist/Isabelle2019/doc/logics.pdf ,第 10 页。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.