【发布时间】:2017-07-05 14:28:04
【问题描述】:
我在 Idris 中写了group 的定义:
data Group: Type -> Type where
Unit: (x: t) -> Group t
(*): Group t -> Group t -> Group t
Inv: Group t -> Group t
postulate
assoc: (a : Group t) -> (b : Group t) -> (c : Group t) -> ((a*b)*c = a*(b*c))
postulate
neutralL: (x: t) -> (a : Group t) -> a * Unit x = a
postulate
neutralR: (x: t) -> (a : Group t) -> Unit x * a = a
postulate
invUnitL: (x: t) -> (a : Group t) -> a * (Inv a) = Unit x
postulate
invUnitR: (x: t) -> (a : Group t) -> (Inv a) * a = Unit x
然后我证明了几个简单的命题:
cong : (a : Group t) -> (b : Group t) -> (c: Group t) -> a = b -> a*c = b*c
cong a b c post = rewrite post in Refl
neutralL1: (x: t) -> (a : Group t) -> a = a * Unit x
neutralL1 x a = rewrite neutralL x a in Refl
neutralR1: (x: t) -> (a : Group t) -> a = Unit x * a
neutralR1 x a = rewrite neutralR x a in Refl
但是,我在证明只有一个单元元素时遇到了问题:
singleUnit : (x: t) -> (y: t) -> (Unit x = Unit y)
我尝试了各种表达方式,使用一个普遍的想法,即Unit x = (by neutralL1 y (Unit x)) = Unit x * Unit y = (by neutralR x (Unit y)) = Unit y,但没有成功:
singleUnit x y = rewrite neutralL1 y (Unit x) in neutralR x (Unit y)
singleUnit x y = rewrite neutralL1 y (Unit x) in rewrite neutralR x (Unit y) in Refl
singleUnit x y = rewrite neutralR x (Unit y) in neutralL1 y (Unit x)
singleUnit x y = rewrite neutralR x (Unit y) in rewrite neutralL1 y (Unit x) in Refl
我如何证明这一点?
我有一种感觉,这里的问题与复杂表达式的替换有关,例如Unit x * Unit y。
【问题讨论】:
标签: proof dependent-type idris theorem-proving formal-verification