有没有一种方法可以在Agda中编程构造(子)证明? 因为有些证据非常相似,所以最好简化它们......但我不知道如何做到这一点。考虑下面的代码如何避免(不必要)重复使用公理在Agda?
{-
At first we reaname Set to (as in Universe)
-}
= Set
{-
We define also a polymorphic idenity
-}
data _==_ {A : } (a : A) : A → where
definition-of-idenity : a == a
infix 30 _==_
{-
The finite set Ω
-}
data Ω : where
A B : Ω
Operation = Ω → Ω → Ω
{-
symmetry is a function that takes an Operation
op and returns a proposition about this operation
-}
symmetry : Operation →
symmetry op = ∀ x y → op x y == op y x
ope : Operation
ope A A = A
ope A B = B
ope B A = B
ope B B = B
proof-of-symmetry-of-operator-ope : symmetry ope
proof-of-symmetry-of-operator-ope A A = definition-of-idenity
proof-of-symmetry-of-operator-ope B B = definition-of-idenity
proof-of-symmetry-of-operator-ope A B = definition-of-idenity
proof-of-symmetry-of-operator-ope B A = definition-of-idenity
为什么我不能只使用以下简化的单行证明?
proof-of-symmetry-of-operator-ope _ _ = definition-of-idenity
似乎模式匹配是造成这种行为的原因。但我不明白为什么。
有没有一种方法来编程构造这样的子证书?用一些meta-agda语言?因为blablabla A B = idenity和blablabla的定义B B = idenity的定义看起来非常相似。最好简化它们......但我不知道如何正确地做到这一点。 –