Coq证明涉及实数文字的算术表达式相等

时间:2019-01-14 06:47:48

标签: coq

我有一个非常漂亮的基本表达式,涉及实数文字和+,即4 = 1 + 1 + 1 + 1

我正在尝试找出如何使用尽可能少的技巧来证明这一事实。

Require Export RIneq. (* probably overkill, but it pulls in
                         enough real number stuff to be useful *)

Open Scope R_scope.

Lemma test_sum2 : 4 = 1 + 1 + 1 + 1.

我试图通过策略选择的断言和垃圾邮件intuition来证明这一点,但是我似乎无法使用该技术在3之上构建整数实数。

Require Export RIneq.

Open Scope R_scope.

Lemma test_sum2 : 4 = 1 + 1 + 1 + 1.
Proof.
assert (1 + 1 = 2).
intuition.
rewrite H.
assert (1 + 2 = 3).
intuition.
assert (1 + 2 = 2 + 1).
intuition.
rewrite H1 in H0.
rewrite H0.
assert (1 + 3 = 3 + 1).
intuition.

让我处于证明状态

1 subgoal
H : 1 + 1 = 2
H0 : 2 + 1 = 3
H1 : 1 + 2 = 2 + 1
H2 : 1 + 3 = 3 + 1
______________________________________(1/1)
4 = 3 + 1

1 个答案:

答案 0 :(得分:2)

基于this的答案,看来field的策略将起作用。我不确定这是否太聪明了。

Require Export RIneq.

Open Scope R_scope.

Lemma test_sum2 : 4 = 1 + 1 + 1 + 1.
Proof.
  field.
Qed.

(在Coq 8.9 + beta1中测试)