"Ring" 不接受 CoqIde 中的策略

"Ring" tactic in CoqIde not accepted

我正在学习 Coq,我需要第一次使用 ring 策略。我曾尝试在 Require Ring.Require ArithRing. 之后使用它来简化我作为目标的方程式的右侧,但 Coq 将其作为不存在的参考。我在这里复制我的一段代码(我用 ringring_simplify 尝试了几次):

Lemma sum_n_p : forall n, 2 * sum_n n + n = n * n.

(* sum_n n is inductively defined as the sum of all numbers between 1 and n *)

Proof.
intros n.
induction n as [ |m IHm].
+simpl.
reflexivity.
+assert (SnSn : S m * S m = m * m + 2 * m + 1).
ring_simplify in [S m * S m = m * m + 2 * m + 1]. (*or just ring. , neither works*)
rewrite SnSn.
rewrite <- IHm.
simpl.
ring.
Qed.

要调用这些策略,您需要导入这些模块,而不仅仅是需要它们:

Require Import ArithRing Ring.

我在添加这些行后尝试了 运行 你的证明,但 Coq 陷入了另一个错误。在 Coq 接受它之前,您可能仍需要调整您的脚本。