简体   繁体   English

coq:在“和”语句中替换真实假设的策略

[英]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.目标只需要应用 l,但我似乎无法弄清楚该策略。 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. rewrite只有在a < d是表示相等或等价关系的符号时才有效,但在这里我假设情况并非如此。

tauto automatically solves your goal, as does easy , but I think you were asking for something less automatic. tauto easy解决您的目标,但我认为您要求的是不那么自动的东西。

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.如果您对使用rewrite这种东西感兴趣, MathComp库以使rewrite成为最有用的策略的方式定义事物,特别是它可以在您的目标的翻译版本中工作。 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);正如@ana-borges 所提到的那样,使用 SSReflect/mathcomp 确实可以rewrite假设l (这就是->所做的); this can then be followed by a split , with a true in the conjunction.这之后可以跟一个split ,连词中有一个true

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.我想通了——你只需要运行propositional ,它会自动评估这种重言式逻辑。

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

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