简体   繁体   中英

coq: Tactic to replace true hypothesis in 'and' statement

Assumptions:
l: a < d

Goal: (s a /\ a < d) <-> s a

Here, I have an /\ with an assumed statement. The goal just needs l to be applied, but I cant seem to figure out the tactic. Apply, rewrite, and replace don't work.

rewrite would only work if a < d was a notation for an equality or an equivalence relation, but here I assume that is not the case.

tauto automatically solves your goal, as does easy , but I think you were asking for something less automatic.

It's a bit disappointing, but the best non-automatic proof I can come up with is to split your goal:

Goal forall a d s, a < d -> (s a /\ a < d) <-> s a.
Proof.
  intros a d s l.
  split.
  - intros [sa _].
    exact sa.
  - intros sa.
    split.
    + exact sa.
    + exact l.
Qed.

If you're interested in using rewrite for this kind of thing, the MathComp library defines things in ways that make rewrite the most useful tactic, and in particular it would work in a translated version of your goal. But probably the best short-term solution here is to make use of some automation tactics.

Using SSReflect/mathcomp, as mentioned by @ana-borges, one can indeed rewrite the Assumption l (which is what -> does); this can then be followed by a split , with a true in the conjunction.

From mathcomp Require Import all_ssreflect.

Goal forall a d s, a < d -> (s a /\ a < d) <-> s a.
Proof. move=> a d s ->; split=> [[sa _] //|sa]; exact: conj. Qed.

Maybe there is another shorter version, though.

I figured it out -- you just have to run propositional , which will evaluate such tautological logic automatically.

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