简体   繁体   English

如何在Coq中使用带有假设的策略?

[英]How to use a tactic with a hypothesis in Coq?

I'm new in Coq and I have run into a dead end. 我是Coq的新手,已经陷入困境。 I have a inductive definition that looks roughly like this (I have defined accept inductively before) : 我有一个大致像这样的归纳定义(我之前已经定义了归纳接受):

Inductive fun : accepts -> Prop :=
  | fn1 : fun True
  | fn2 : forall (n : nat )(A : accepts), fun A -> fun (n A).

What I need to prove is this: 我需要证明的是:

Lemma lem_1  (A : formula) (n : nat) (h : fun (n A)) : fun A.

Of course, at starting the proof I get 当然,在开始证明时,我会得到

 A : accepts
 n : nat
 h : fun (n A)
 ============================
 fun A

I have spent a long time reading about tactics, trying to find some way to be able to plug h into my fn2 or something like that, and I just can't find a way to do that. 我花了很长时间阅读有关战术的文章,试图找到某种方法可以将h插入我的fn2之类的东西,但我只是找不到一种方法。 Can someone please guide me here and give me some idea?? 有人可以在这里指导我,给我一些想法吗? I've also tried doing something to simplify fun A into A but I have not succeeded there either. 我也尝试过做一些将A简化为A的事情,但是我也没有成功。 Thank you very much for your help! 非常感谢您的帮助!

It seems that you want to argue that your h hypothesis was produced using the fn2 rule. 您似乎想证明您的h假设是使用fn2规则产生的。 In Coq jargon, this requires inverting that hypothesis. 用Coq术语来说,这需要颠倒这一假设。 To do that, you can call inversion h . 为此,您可以调用inversion h Applying is the opposite process: combining the fn2 rule with a hypothesis that states fun A to derive fun (n A) . 应用是相反的过程:将fn2规则与陈述fun A的假设相结合以得出fun (n A)

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

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