coq中存在变量的实例化规则
我从事编程语言基础工作,对这一行感到困惑: “不能使用存在变量 用包含普通变量的术语实例化 在创建存在变量时存在。” 为什么不呢?我能举一个展示不想要的行为的例子吗coq中存在变量的实例化规则,coq,Coq,我从事编程语言基础工作,对这一行感到困惑: “不能使用存在变量 用包含普通变量的术语实例化 在创建存在变量时存在。” 为什么不呢?我能举一个展示不想要的行为的例子吗 谢谢。这里有一个示例: (* An empty type *) Inductive empty : Type := . (* A proposition quantifying existentially over an empty type can only be false... *) Lemma this_cannot_be
谢谢。这里有一个示例:
(* An empty type *)
Inductive empty : Type := .
(* A proposition quantifying existentially over an empty type can only be false... *)
Lemma this_cannot_be_true : exists x : empty, (forall y : empty, x = y).
Proof.
eexists. (* I'm telling you there is such an x, just put an evar ?x for now. *)
intros y. (* Now we must prove a universal property, so we introduce a new variable... *)
Fail instantiate (1 := y). (* Oh look, y : empty, let's instantiate our evar with it! *)
(* If this didn't fail, we would have the goal (y = y), which would be proved by reflexivity. Luckily, the previous tactic failed. *)
Abort.
(* To clear out any doubt that the above proposition is false. *)
Lemma empty_type_is_empty {P : empty -> Prop} : (exists x : empty, P x) -> False.
Proof.
intros [[]].
Qed.
这实际上只是范围界定,这是相当常识的。只是当你使用战术而不仅仅是写术语时,你可能会有点难以理解。在
简介y
之后,证明项看起来像这不可能是真的:=ex\u intro\uuuuux(fun y=>?Goal)
。实例化
正在尝试设置X:=y
,下面的自反性
将给您留下ex\u intro\uuy(fun y=>eq\u refl y)
。这被拒绝,因为您试图在绑定/定义它的上下文之外(在fun y
下)使用y
。这是一个很好的解释。我只是不认为问这个问题的人熟悉这些策略产生的证明条件。这是“常识”,只适用于那些有正确背景的人。