简体   繁体   中英

How to use a tactic with a hypothesis in Coq?

I'm new in Coq and I have run into a dead end. 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. 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. Thank you very much for your help!

It seems that you want to argue that your h hypothesis was produced using the fn2 rule. In Coq jargon, this requires inverting that hypothesis. To do that, you can call inversion h . Applying is the opposite process: combining the fn2 rule with a hypothesis that states fun A to derive fun (n A) .

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