在Coq中"判断相等递归类型的相等性"?

jmi*_*ite 5 functional-programming theorem-proving coq dependent-type coq-tactic

有没有办法decide equality在Coq中使用相互递归类型的策略?

例如,如果我有这样的事情:

Inductive LTree : Set :=
  | LNil
  | LNode (x: LTree) (y: RTree)
  with RTree : Set :=
    | RNil
    | RNode (x: Tree) (y: RTree).

Lemma eq_LTree : forall (x y : LTree), {x = y} + {x <> y}.
Proof.
    decide equality; auto.
Run Code Online (Sandbox Code Playgroud)

这让我有了目标:

y0: RTree
y1: RTree
{y0 = y1} + {y0 <> y1}
Run Code Online (Sandbox Code Playgroud)

但是在我导出相等性之前我无法解决这个RTree问题,因为它会产生同样的问题.

Ant*_*nov 8

decide equality如果你同时证明LTrees和RTrees 的两个引理,你可以使用这种情况:

Lemma eq_LTree : forall (x y : LTree), {x = y} + {x <> y}
with  eq_RTree : forall (x y : RTree), {x = y} + {x <> y}.
Proof.
  decide equality.
  decide equality.
Qed.
Run Code Online (Sandbox Code Playgroud)

  • 这很奇怪,"守卫"在第一次"决定平等"后抱怨,但后来"Qed"没有被拒绝. (2认同)
  • 没关系,我在coq-club上找到了[线程](https://sympa.inria.fr/sympa/arc/coq-club/2011-11/msg00297.html)讨论这个特殊问题. (2认同)