Types “重写”类型

Types “重写”类型,types,coq,Types,Coq,我有以下Coq代码: Set Implicit Arguments. Record eq {X : Set} (R : X -> X -> Prop) : Set := mkEq { reflexivity: forall x, R x x }. Record eqSet : Type := make { set : Set; r : set -> set -> Prop; r_eq : eq r }. Definitio

我有以下Coq代码:

Set Implicit Arguments.

Record eq {X : Set} (R : X -> X -> Prop) : Set := 
  mkEq {
    reflexivity: forall x, R x x
}.

Record eqSet : Type := 
  make {
    set : Set;
    r : set -> set -> Prop;
    r_eq : eq r
}.

Definition Nat : eqSet.
  refine (make (set:=nat) (r := fun x y => x = y) _).
  apply mkEq.
  auto.
Defined.

Lemma ex : forall (x : set Nat) (P : nat -> Prop), P x.
  intro.
引理ex只是我想做的一个例子。在最后的介绍之后,我的假设是:

x : set Nat
我想用Nat替换SETNAT。战术琐碎已经证明了set Nat=Nat。可能吗?

您的主要问题是目标中使用了x,因此更改其类型也可能会影响目标的类型。如果你表现出色

  assert (h: set Nat = nat) by now trivial.
  revert x.
  rewrite h.
你会有一个打字错误

我不知道该怎么做才好

V.

您可以简化*。