Coq:证明如果(A,B)=(C,D)则A = C / \ B = D

时间:2019-12-19 12:23:55

标签: coq theorem-proving

正如标题中所示,我找不到足够的工具来解决这一琐碎的事情:

p : (A, B) = (C, D)
------------
A = C /\ B = D

我怎么证明呢?

2 个答案:

答案 0 :(得分:1)

一种更原始​​的证明方法是injection p

使用假设pair_equal_spec重写(a1, b1) = (a2, b2)fst (a1, b1),看看标准库中snd (a1, b1)本身是如何证明的。

Lemma pair_equal_spec :
  forall (A B : Type) (a1 a2 : A) (b1 b2 : B),
    (a1, b1) = (a2, b2) <-> a1 = a2 /\ b1 = b2.
Proof with auto.
  split; intros.
  - split.
    + replace a1 with (fst (a1, b1)); replace a2 with (fst (a2, b2))...
      rewrite H...
    + replace b1 with (snd (a1, b1)); replace b2 with (snd (a2, b2))...
      rewrite H...
  - destruct H; subst...
Qed.

答案 1 :(得分:0)

就知道了。是pair_equal_spec

Proof.
  intros.
  apply pair_equal_spec.
  assumption.
Qed.
相关问题