将合并目标拆分为子目标

时间:2017-05-12 20:20:22

标签: coq coq-tactic

考虑以下玩具练习:

Theorem swap_id: forall (m n : nat), m = n -> (m, n) = (n, m).
Proof.
  intros m n H.

此时我有以下内容:

1 subgoal
m, n : nat
H : m = n
______________________________________(1/1)
(m, n) = (n, m)

我想将目标分为两个子目标m = nn = m。有没有这样做的策略?

1 个答案:

答案 0 :(得分:3)

使用f_equal策略解决:

Theorem test: forall (m n : nat), m = n -> (m, n) = (n, m).
Proof.
  intros m n H. f_equal.

状态:

2 subgoals
m, n : nat
H : m = n
______________________________________(1/2)
m = n
______________________________________(2/2)
n = m