在前提中引入新的假设

Introducing new hypothesis in the premises

我目前的目标如下:

  n' : nat
  IHn' : forall m : nat, n' + n' = m + m -> n' = m
  m' : nat
  H1 : n' + n' = m' + m'
  ============================
   S n' = S m'

现在,我想apply H1IHn'中引入以下假设:

n' = m'

我试过这个:

apply H1 with (m := m') in IHn'.

但这给了我这个错误:

Error: No such bound variable m.

这是具有以下目标的完整可复制程序:

Theorem my_theorem : forall n m,
     n + n = m + m -> n = m.
Proof.
  intros n. induction n as [| n'].
  - simpl. 
    intros m H.
    symmetry in H.
    destruct m as [| m'].
    + reflexivity.
    + rewrite -> plus_Sn_m in H.
      inversion H.
  - simpl.
    rewrite <- plus_n_Sm.
    intros m.
    intros H.
    destruct m as [| m'].
    + simpl in H.
      inversion H.
    + rewrite -> plus_Sn_m in H.
      rewrite <- plus_n_Sm in H.
      inversion H.
Abort.

问题是您的 apply 倒退了。你需要写 apply IHn' with (m := m') in H1. 请注意,在这种情况下,省略 with (m := m') 子句是安全的,因为 Coq 足够聪明,可以自己找出该信息。