j'ai écrit une définition de group à Idris:Idris - réécriture dans le théorème simple, la preuve
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
Je prouvé quelques propositions simples:
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
Cependant, j'ai un problème avec proving qu'il n'y a qu'un seul élément d'unité:
singleUnit : (x: t) -> (y: t) -> (Unit x = Unit y)
J'ai essayé diverses expressions en utilisant un général idée, que Unit x
= (par neutralL1 y (Unit x)
) = Unit x * Unit y
= (par neutralR x (Unit y)
) = Unit y
, mais sans succès:
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
Comment puis-je prouver? J'ai le sentiment, que le problème ici est lié à la substitution d'expressions complexes, comme Unit x * Unit y
.