简体   繁体   中英

Coq: Simplify (negb (neqb true) to true using “rewrite” or “apply”?

In proofs, I want to simplify (negb (negb true)) to true (likewise with false ).

I know of Coq's negb_involutive procedure, but since my textbook hasn't introduced it, I think that I should somehow manage to imitate its functionality using only rewrite or apply .

As Anton said, the typical procedure to solve this goal would be to use reflexivity , or its lower-level version apply eq_refl .

Recall that Coq is based on a programming language and in this case indeed the execution of ~~ (~~ true) is easily seen to be true (where I abbreviate ~~ x = negb x ), in the same way it would return true in Python or C.

apply eq_refl will solve the goal as Coq will try to "compute" or "reduce" terms when tying to make things match. The type of eq_refl is forall x, x = x , thus when ~~ (~~ true) is reduced to true your goal now becomes true = true and it can be solved. In this case, simpl will just reduce the goal for you to see it but it is technically not needed in the proof.

It is not idiomatic to apply negb_involutive in your case, this lemma is useful when the argument to negb is a variable, like in ~~ (~~ (~~ x)) = ~~ x .

You'll find yourself using rewrite in most goals involving equality.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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