coq - 函数参数可以在 Coq 中自动限定范围吗?
问题描述
假设我正在一个经常混合 nat 和 Z 的环境中工作。例如,如果我有
Require Import List ZArith.
Import ListNotations.
Open Scope Z_scope.
Definition f (l : list nat) := l.
Compute f [1;3].
Coq 告诉我我The term "[1; 3]" has type "list Z" while it is expected to have type "list nat".
当然可以写[1;3]%nat
,但我想知道是否有更好的方法,因为通常没有歧义。
一个相关的问题是:我可以避免手动定义符号参数的范围吗?
Notation "\\\ l ///" := (f l).
Compute \\\[1;3]///. (* same error as before *)
解决方案
推荐阅读
- sql - 外部和联合都在同一张桌子上?
- node.js - 文件上传 - 如何使用 Cloudinary Node.js SDK 获取上传进度
- react-native-navigation - 有没有办法禁用顶部栏中的右键?
- amazon-web-services - 十六进制安装在 aws 实例上失败,无法获取元数据
- tensorflow - 为什么 Dense 层比 Conv Layers、Recurrent Layers 与 BERT embddings 在情感分析上的混合表现更好?
- javascript - TypeError 无法在 React 中获取
- javascript - 获取对象数组中的属性值总和
- mysql - 在 MySQL 查询中使用别名表而不创建 VIEW
- angular - 将接口类型变量序列化为字符串
- optaplanner - optaplanner - 在运行时禁用 PlanningVariable