我正在从 Naturals 自下而上构建整数,并尝试直接应用态射重写,而不是将其添加为 setoid 态射,因为在我的情况下,这样做既困难又不自然,但是测试用例失败并出现以下错误:
The term "x = x" has type "Prop" while it is expected to have type "x = x".
以下 MRE 也抛出了这个问题:
Require Import Setoid.
(* Custom natural Set *)
Parameter CNat : Set.
(* Addition *)
Parameter CAdd : CNat -> CNat -> CNat.
Infix "±" := CAdd (at level 50, left associativity).
(* Addition Morphism *)
Axiom cnat_add_morphism :
forall (x x' : CNat), x = x' ->
forall (y y' : CNat), y = y' ->
x ± y = x' ± y'.
(* Test Example *)
Example cnat_add_inc :
forall (x y c : CNat), x = y -> x±c = y±c.
Proof.
intros x y c CH.
rewrite (@cnat_add_morphism x x (x=x) c c (c=c)). (* #Error *)
是否有可能告诉cnat_add_morphism(在我的代码中哪个是定理而不是公理)来解释这些术语x¦x并c¦c作为使态射正常工作的类型,或者能够应用手动态射重写而不是添加它的不同类型作为一个setoid?