record - Coq 记录类型
问题描述
我是 Coq 的新手。当我尝试定义两个具有相同名称的类型字段的记录类型时,我得到一个错误。例如:
Record squag := {
U : Type;
op : U -> U -> U where "x * y" := (op x y);
idempotent_op : forall x : U, (x * x) = (x);
commutative_op : forall x y : U, (x * y) = (y * x);
antiAbsorbent_op : forall x y: U, (x * (x * y)) = (y)
}.
Record dummy := {
U : Type;
zero : U
}.
我得到的错误是:
错误:U 已经存在。
任何帮助表示赞赏。
解决方案
您不能在 Coq 命名空间中重复使用记录名称。但是,您可以做的是在单独的文件或模块中声明这两条记录:
Module Squag.
Record squag := {
U : Type;
op : U -> U -> U where "x * y" := (op x y);
idempotent_op : forall x : U, (x * x) = (x);
commutative_op : forall x y : U, (x * y) = (y * x);
antiAbsorbent_op : forall x y: U, (x * (x * y)) = (y)
}.
End Squag.
Module Dummy.
Record dummy := {
U : Type;
zero : U
}.
End Dummy.
然后,您可以将这两个字段分别称为Squag.U
和Dummy.U
。
推荐阅读
- laravel - Subscriptions 和 subscription_item 数据库使用 Stripe 结帐为空
- c - 像这样使用 pragma omp simd 是否正确?
- ios - 我可以使用 testflight 超过 90 天吗?
- omnet++ - 特定范围内的节点数
- node.js - 更新元素时,默认值为 false 或 null,发生错误 TypeError: Cannot read property 'exvariable' of null
- paypal - 如何在我的 PayPal 企业帐户上设置付款?
- android - Flutter Phone 身份验证在模拟器上运行良好,但在真实设备(Android)上无法运行
- cmake - 如何添加多个将输出与已知良好输出文件进行比较的 CTest?
- javascript - 调用谷歌云函数的 https 函数时收到的数据为零
- amazon-web-services - 资源定义格式错误