作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
match x with -6ren">
这两个定义有什么区别:
Definition f : forall x:bool, if x then bool else nat :=
fun x => match x with
| true => true
| false => 42
end.
(* ^ Accepted by Coq *)
Definition g : forall x:bool, if x then bool else nat :=
fun x => if x then true else 42.
(* ^ REJECTED *)
if
字面意思是
match
的糖但似乎在依赖模式匹配方面受到更多限制,即使它也支持
return
反正语法。
最佳答案
这对我来说似乎是一个错误:如果你让 Coq 打印 f
,它显示 match
作为 if
.
f =
fun x : bool =>
if x as x0 return (if x0 then bool else nat) then true else 42
: forall x : bool, if x then bool else nat
f is not universe polymorphic
Argument scope is [bool_scope]
关于coq - "if"不仅仅是 "match"的糖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55028919/
我是一名优秀的程序员,十分优秀!