Coq “隐藏的目标”错误消息是什么意思

Coq “隐藏的目标”错误消息是什么意思,coq,Coq,编辑:我包括了证据 我从一个文件到另一个文件复制了一份来自软件基金会的证明。在原始文件中,一切都编译得很好。在新文件中,出现以下错误: Hs is used in hypothesis _the_hidden_goal_. 是由线路引起的 rewrite H in Hs. 这是什么意思?在谷歌搜索“隐藏目标”后,我发现的唯一信息是。根据那个链接,我把冒犯的行改为 rewrite H in Hs *. 现在它可以编译了,但我不明白为什么 多谢各位 编辑: 以下是导致包含*的问题的证据 引理e

编辑:我包括了证据

我从一个文件到另一个文件复制了一份来自软件基金会的证明。在原始文件中,一切都编译得很好。在新文件中,出现以下错误:

Hs is used in hypothesis _the_hidden_goal_.
是由线路引起的

rewrite H in Hs.
这是什么意思?在谷歌搜索“隐藏目标”后,我发现的唯一信息是。根据那个链接,我把冒犯的行改为

rewrite H in Hs *.
现在它可以编译了,但我不明白为什么

多谢各位

编辑:

以下是导致包含*的问题的证据

引理eqb_string_true_iff:forall x y:string, 等式b_字符串x y=true x=y。 证据 简介xy。 展开eqb_字符串。 自毁字符串_decx y为[H | Hs]。 -分裂。自反性。自反性。 -分开。 +反面介绍。反歧视。 +介绍H。在Hs*中重写H。破坏Hs。自反性。 Qed

这个问题仍然发生在一个只包含proof、eqb_字符串和一些import语句的文件中。以下是该文件的全部内容

From Coq Require Import Bool.Bool Init.Nat Arith.Arith Arith.EqNat
     Init.Datatypes Lists.List Strings.String.
Require Export Coq.Strings.String.
From mathcomp Require Import ssreflect ssrfun ssrbool eqtype.
Import ListNotations.
Open Scope string_scope.

Definition eqb_string (x y : string) : bool :=
  if string_dec x y then true else false.


Lemma eqb_string_true_iff : forall x y : string,
    eqb_string x y = true <-> x = y.
Proof.
   intros x y.
   unfold eqb_string.
   destruct (string_dec x y) as [H |Hs].
   - subst. split. reflexivity. reflexivity.
   - split.
     + intros contra. discriminate contra.
     + intros H. rewrite H in Hs. destruct Hs. reflexivity.
Qed.
Close Scope string_scope.

在Hs中键入rewrite H时,SSReflect大致执行如下操作:

set (_the_hidden_goal_ := _). (* hide the goal to prevent rewriting in it *)
revert Hs. (* put the hypothesis in the goal to rewrite in it *)
pattern x. (* extract the left-hand side of the equality *)
case H. (* perform the actual rewriting *)
intros Hs. (* put back the hypothesis in the context *)
unfold _the_hidden_goal_. (* restore the goal *)
由于Hs发生在_the _hidden _goal u的主体中,因此恢复Hs的调用失败,因此会收到错误消息

通过在Hs*中使用rewrite H,您可以告诉SSReflect您希望在Hs和目标中都进行重写。因此,SSReflect跳过了第一步和最后一步。这就解决了问题


注意,这里唯一特定于SSReflect的是名称_the_hidden_goal_的用法。如果使用Coq的香草重写,您也会遇到类似的失败。更准确地说,Hs中的rewrite->H抱怨如下消息:无法更改Hs,它用于总结。

您复制的证据是什么?+1。如果这是SF的一个练习,如果你能尝试在一些不相关的东西中重现失败,那就太好了。如果是这样的话,那为什么这行代码在软件基础文件中没有星号?在SF文件中用Hs重写H时,Hs是否出现在目标中?不,不是!我不想检查,因为两个文件中的证明完全相同,但从表面上看,证明状态完全不同!在新文件中,它表示if is_left right Hs then true else false=true,但在SF文件中,它表示false=true!在证明的同一点上!完全相同的代码如何在两个不同的文件中表现得如此不同?请注意,如果is_left right Hs,那么true else false=true与false=true相比,只有一个beta delta iota减少。所以,大多数战术都可能触发了它。不过,我不知道为什么其中一种策略在两个文件之间的行为会有所不同。在您的例子中,根据是否导入ssreflect,析构函数的行为似乎有所不同。我不知道为什么,这可能是Coq中的一个bug。无论如何,您可以在重写之前调用siml来触发缩减。