[英]Decidable equality of data types in Agda
我正在嘗試使用 Agda stdlib 證明 Agda 中數據類型的可判定相等性。 我有以下代碼,但我不確定該填什么。 目標似乎是有道理的,但實際上構建它是具有挑戰性的。
這在 Agda 中是否可行,是否有關於如何解決此問題的任何想法?
open import Data.String as String hiding (_≟_)
open import Relation.Nullary
open import Relation.Binary
open import Relation.Binary.PropositionalEquality
module Problem1 where
data Test : Set where
test : String → Test
infix 4 _≟_
_≟_ : Decidable {A = Test} _≡_
test x ≟ test x₁ with x String.≟ x₁
... | yes refl = yes refl
... | no ¬a = no {!!}
洞:
Goal: ¬ test x ≡ test x₁
————————————————————————————————————————————————————————————
¬a : ¬ x ≡ x₁
x₁ : ℕ
x : ℕ
這實際上是一個單行,依賴於匿名函數內的相等性證明的大小寫拆分,如下所示:
... | no ¬a = no λ {refl → ¬a refl}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.