表示两个函数等价证明的数据类型
Data type that represents the proof that two functions are equivalent
我试图创建一个数据类型来表示两个函数是等价的。错误是什么意思?
代码:
record FEq (f1 : a -> b) (f2 : a -> b) where
constructor MkFEq
unFEq : (x : a) -> (f1 x = f2 x)
错误:
Type checking ./FEq.idr
FEq.idr:1:1-3:36:
|
1 | record FEq (f1 : a -> b) (f2 : a -> b) where
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ...
When checking type of Main.FEq.unFEq:
When checking argument x to type constructor =:
Type mismatch between
free_a b a f1 f2 rec
and
a
据我所知,您不能在记录中提及未绑定的参数。
所以你必须添加 a
和 b
作为参数,如下所示:
record FEq a b (f1 : a -> b) (f2 : a -> b) where
constructor MkFEq
unFEq : (x : a) -> (f1 x = f2 x)
我试图创建一个数据类型来表示两个函数是等价的。错误是什么意思?
代码:
record FEq (f1 : a -> b) (f2 : a -> b) where
constructor MkFEq
unFEq : (x : a) -> (f1 x = f2 x)
错误:
Type checking ./FEq.idr
FEq.idr:1:1-3:36:
|
1 | record FEq (f1 : a -> b) (f2 : a -> b) where
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ...
When checking type of Main.FEq.unFEq:
When checking argument x to type constructor =:
Type mismatch between
free_a b a f1 f2 rec
and
a
据我所知,您不能在记录中提及未绑定的参数。
所以你必须添加 a
和 b
作为参数,如下所示:
record FEq a b (f1 : a -> b) (f2 : a -> b) where
constructor MkFEq
unFEq : (x : a) -> (f1 x = f2 x)