如何在Coq中定义对的相等性?

时间:2018-03-25 07:10:21

标签: coq

我定义了一个类型如下:

Definition trans := env -> env -> Prop.
Definition tripored := trans * trans * trans.
Definition qt (t : tripored) := fst (fst t).
Definition wt (t : tripored) := snd (fst t).
Definition tt (t : tripored) := snd t.
Definition II := (ttrue, tfalse, I).

然后我根据三重定义一个运算符,例如

Definition seqtr (m n : tripored) : tripored :=
(
  nott (ort (nott (qt m)) (dseq (tt m) (nott (qt n)))),
  ort (wt m) (dseq (tt m) (wt n)),
  dseq (tt m) (tt n)
).

有许多运算符,例如 ort dseq 等。我想证明以下定理:

Theorem seqtr_ii :
  forall n : tripored, seqtr n II = n.

然而,由于(seqtr n II)具有 trans * trans * trans 类型,我发现很难证明这个定理。任何人都可以为这个定理提出一些建议吗?

1 个答案:

答案 0 :(得分:3)

Since you did not provide all the definitions, it is hard to answer precisely, but I will try.

Since n is a triple, you can first extract its components with destruct n as ((t1, t2), t3), where t1, t2, t3 are of type trans.

Then unfold seqtr replaces seqtr with its body.

The conclusion becomes an equality of two triples. To turn it into 3 goals stating the equality of the components, you can use do 2 apply f_equal2 or just f_equal.