简体   繁体   English

如何在Coq的假设中实例化forall变量?

[英]How to instantiate a variable of forall in a hypothesis in Coq?

I have two hypotheses 我有两个假设

IHl: forall (lr : list nat) (d x : nat), d = x \/ In x l' -> (something else)
Head : d = x

I want to apply IHl on Head as it satisfies d = x \\/ In xl of IHl. 我想在Head apply IHl ,因为它满足apply IHl d = x \\/ In xl I tried apply with tactic which fails with a simple hint Error: Unable to unify . 我试过用一个简单提示失败的战术apply with Error: Unable to unify

Which tactic should I use to instantiate variables in a hypothesis? 我应该使用哪种策略来实例化假设中的变量?

Your hypothesis IHl takes 4 arguments: lr : list nat , d : nat , x : nat , and _ : d = x \\/ In x l' . 你的假设IHl有4个参数: lr : list natd : natx : nat ,和_ : d = x \\/ In x l'

Your hypothesis Head : d = x does not have the proper type to be passed as the 4th argument. 你的假设Head : d = x没有正确的类型作为第四个参数传递。 You need to turn it from a proof of equality into a proof of a disjunction. 你需要将它从平等证明转变为分离证明。 Fortunately, you can use: 幸运的是,您可以使用:

or_introl
     : forall A B : Prop, A -> A \/ B

which is one of the two constructors of the or type. 这是的两个构造中的一个or类型。

Now you might have to pass explicitly the B Prop, unless it can be figured out in the context by unification. 现在您可能必须明确传递B Prop,除非可以通过统一在上下文中找出它。

Here are things that should work: 以下是应该工作的事情:

(* To keep IHl but use its result, given lr : list nat *)
pose proof (IHl lr _ _ (or_introl Head)).

(* To transform IHl into its result, given lr : list nat *)
specialize (IHl lr _ _ (or_introl Head)).

There's probably an apply you can use, but depending on what is implicit/inferred for you, it's hard for me to tell you which one it is. 可能有一个你可以使用的apply ,但是根据你隐含/推断的内容,我很难告诉你它是哪一个。

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

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