有沒有一種方法可以在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的定義看起來非常相似。最好簡化它們......但我不知道如何正確地做到這一點。 –