agda - 如何在前提下进行重写?
问题描述
Any-comm : ∀ {A : Set} {P : A → Set} (xs ys : List A) →
Any P (xs ++ ys) → Any P (ys ++ xs)
Any-comm xs [] prf = {!!}
Goal: Any P xs
————————————————————————————————————————————————————————————
prf : Any P (xs ++ [])
xs : List A
P : A → Set (not in scope)
A : Set (not in scope)
如何prf
在此处使用附加标识重写?我想我可以改写目标以匹配,但是在前提下是否可以这样做?我觉得后面会更整洁。
解决方案
啊,看来我对重写如何工作的假设是错误的。
Any-comm xs [] prf rewrite sym (++-identityʳ xs) = {!!}
Goal: Any P (xs ++ [])
————————————————————————————————————————————————————————————
prf : Any P ((xs ++ []) ++ [])
P : A → Set (not in scope)
xs : List A
A : Set (not in scope)
当我尝试上述方法时,我惊讶地发现它重写了目标和前提。因此,从那里重写前提的方式是。
Any-comm xs [] prf rewrite ++-identityʳ xs = prf
我不确定这是否应该如此令人惊讶,但尽管我几乎阅读了 PLFA 书的第 1 卷的全部内容,但我并没有注意到这一点。这种行为与 Coq 的重写不同。
推荐阅读
- ethereum - 安全帽节点 localhost 不工作。空主机?
- spring-kafka - 我想对 @KafkaListener 使用 pause() 和 resume() 方法,但它没有失败
- git - 我正在尝试克隆一个私人仓库,但它说找不到存储库?
- java - 如何简单地对 ArrayList<> 的元素进行统计操作
- python - KivyMD 刷新屏幕时屏幕重复
- r - 使用 R 中的 rvest 库从网页中抓取信息
- amazon-web-services - AWS Cloudformation:RDS 的 CloudWatch 警报是否需要 IAM 角色?
- laravel-8 - Vuejs3 道具从 laravel 刀片到 vue 组件未定义
- python - 无法在 Mac M1 中安装 tensorflow
- powershell - 使用 Graph API 在 MS Teams 中创建在线会议 - 在要求管理员创建应用程序访问策略时改善用户体验