(** **** Exercise: 3 stars, standard, optional (ev_plus_plus)
This exercise just requires applying existing lemmas. No
induction or even case analysis is needed, though some of the
rewriting may be tedious. *)
Theorem ev_plus_plus : forall n m p,
even (n+m) -> even (n+p) -> even (m+p).
Proof.
intros n m p H1 H2.
这是我得到的:
1 subgoal (ID 89)
n, m, p : nat
H1 : even (n + m)
H2 : even (n + p)
============================
even (m + p)
我已经证明了前面的定理:
Theorem ev_ev__ev : forall n m,
even (n+m) -> even n -> even m.
并想将其应用于 H1,但是
apply ev_ev__ev in H1.
给出一个错误:
Error: Unable to find an instance for the variable m.
为什么在表达式中找不到“m” even (n + m)
?怎么修?
更新
apply ev_ev__ev with (m:=m) in H1.
给出了一个非常奇怪的结果:
2 subgoals (ID 90)
n, m, p : nat
H1 : even m
H2 : even (n + p)
============================
even (m + p)
subgoal 2 (ID 92) is:
even (n + m + m)
我认为它会将 H1 转换为 2 假设:
H11 : even n
H12 : even m
但相反,它给出了 2 个子目标,我们需要证明的第二个子目标比最初的更复杂:
even (n + m + m)
这里发生了什么事?