logic - How to use the rewrite command in coq for inner subexpressions?
问题描述
I have a lemma telling that addition commutes:
Lemma commute: for all x y, add x y = add y x.
Now in my goal, I am trying to prove that:
add (add x (S y)) z = add x (S (add y z))
I would like to use my lemma to rewrite the inner add on the left
add x (S y)
to add (S y) x
.
However, the command rewrite commute
instead rewrites the outer add:
add (add x (S y)) z
to add z (add x (S y))
.
Question: how to use commute for rewriting inner subexpressions?
解决方案
您可以使用以下方法精确说明您想要用于引理的参数:
rewrite commute with (x := x)(y :=(S y)).
但更常见的是像函数一样应用它:
rewrite (commute x (S y)).
如果指定的参数之一很明显,您可以避免在第一种情况下提及它,或者在第二种情况下添加下划线,这将给出:
rewrite commute with (y :=(S y)).
和
rewrite (commute _ (S y)).
推荐阅读
- jquery - 获取表格高度返回负值
- javascript - 如何将按钮(来自页面内容)附加到粘性标题?
- django-templates - 如何从使用 Django 从数据库加载的 HTML 链接到静态文件夹中的文件
- android - AirtelMoney API 与 Android 应用程序的集成
- javascript - 使用 Angular CLI 在组件之间处理数据时遇到问题
- javascript - 如何删除wordpress中的页面链接?
- c# - 从 .NET 2 转换为 .NET 3.0 后出现 InvalidOperationException
- firebase - 云函数增量计数器不读取文档
- javascript - 只有在回调/异步函数内部时,Axios 请求才会收到 CORS 错误
- matlab - 如何在MATLAB中对矩阵中每一行的列进行置换?