简体   繁体   English

Coq 错误:无法将“true”与“is_true (0 < a - b - 3)”统一起来

[英]Coq error: Unable to unify "true" with "is_true (0 < a - b - 3)"

Not sure what I am doing wrong but I thought reflexivity should work on below, but it does not.不确定我做错了什么,但我认为reflexivity应该在下面起作用,但事实并非如此。

a, b : nat
H : (1 <=? a - b - 3) = true
______________________________________(1/7)
is_true (0 < a - b - 3)

I also tried to apply leb_complete in H. which resulted in:我还尝试apply leb_complete in H.apply leb_complete in H. ,结果是:

a, b : nat
H : (1 <= a - b - 3)%coq_nat
______________________________________(1/7)
is_true (0 < a - b - 3)

but in both cases, Coq gives me an error saying Unable to unify "true" with "is_true (0 < a - b - 3)"但在这两种情况下,Coq 都给我一个错误,说Unable to unify "true" with "is_true (0 < a - b - 3)"

It shouldn't be that complicated, right?应该没那么复杂吧? Am I missing something here?我在这里错过了什么吗?

First, “it shouldn't be complicated” is the wrong question.首先,“它不应该很复杂”是一个错误的问题。

reflexivity is a tactic that never uses assumptions, and that tries to prove goals in a very specific way. reflexivity是一种从不使用假设的策略,它试图以非常具体的方式证明目标。 For “easy” purely numeric goals p, you can use lia.对于“简单”的纯数字目标 p,您可以使用 lia。

It can only prove goals convertible to shape R a1 a2 where R is a reflexive relation (like equality) and a1 and a2 are convertible.它只能证明目标可转换为形状R a1 a2 ,其中 R 是自反关系(如等式)并且 a1 和 a2 是可转换的。 And two terms are convertible if reducing them to normal form gives “the same” result (modulo some complications for eta-expansion).如果将两个项减少到正常形式给出“相同”的结果(以 eta 扩展的一些并发症为模),则这两个项是可转换的。

For instance, reflexivity can prove that 2 + 2 + 0 = 4, or that 0 + n = n.例如,自反性可以证明 2 + 2 + 0 = 4,或 0 + n = n。 But it cannot prove that n + 0 = n (which can be proved by lia), because n + 0 is a normal form.但是不能证明n+0=n(可以用lia证明),因为n+0是范式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM