Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Coq 在证明过程中,如何将单个统一变量转化为目标_Coq - Fatal编程技术网

Coq 在证明过程中,如何将单个统一变量转化为目标

Coq 在证明过程中,如何将单个统一变量转化为目标,coq,Coq,我想以交互方式构造一个存在变量。我不能使用,因为我需要在完成目标之前填充存在主义 最小exmaple 这里是一个最小的例子(因为它很简单,有其他的解决方案,但它说明了我的问题) 在这一点上,有两种解决方案无法回答我的问题:(1)我可以运行(eauto),然后执行获取存在变量,但假设在实例化统一变量之前,eauto不会成功;(2) 我可以用instantiate(1:=h0h)(或者甚至instantiate(1:=ltac:(eauto))显式地传递证明项,但是假设现有的证明是乏味的,我们希望以

我想以交互方式构造一个存在变量。我不能使用,因为我需要在完成目标之前填充存在主义

最小exmaple 这里是一个最小的例子(因为它很简单,有其他的解决方案,但它说明了我的问题)

在这一点上,有两种解决方案无法回答我的问题:(1)我可以运行(
eauto
),然后执行
获取存在变量
,但假设在实例化统一变量之前,eauto不会成功;(2) 我可以用
instantiate(1:=h0h)
(或者甚至
instantiate(1:=ltac:(eauto))
显式地传递证明项,但是假设现有的证明是乏味的,我们希望以交互方式进行

我们还能做什么?我们可以尝试使用
cut
assert
,如下所示:

match goal with
      |[|- P (filter ?x)] =>
       match type of x with
       | ?T => assert (HH:T) by eauto
       end
      end.
但是HH不在unification变量的上下文中,因此不能实例化它

  instantiate(1:=HH). (* Instance is not well-typed in the environment of ?H. *)
据我所知,解决这个问题的唯一方法是使用
Show existentics
,查看变量的类型,手动复制它,将证明回滚到引入统一之前,并在那里构造变量。在本例中,它如下所示:

Lemma my_lemma:
  forall a b, Q b -> (Q b -> P a) ->
         exists a (H: P a), P (filter H).
Proof.
  intros ?? H H0.
  do 2 eexists.
  Show Existentials.  
  Restart. (* This command restores the proof editing process to the original goal. *)
  intros ?? H H0.
  assert (HH:P a) by eauto.
  eexists; exists HH.
  auto.
Qed.

显然,我希望避免这种工作流。那么,无论如何,把存在变量变成子目标

您的最佳选择可能是首先避免将存在变量创建为evar。您不必手动构造变量来完成此操作;如果你能确定它是在哪里创建的,你可以用
unshelve t
将违规战术包装起来,将
t
创建的所有评估转化为目标。这可能很困难的地方是,如果相关策略深入到某些自动化中,并且难以识别或更改。

谢谢!这不是我想要的,但比其他选择要好。不幸的是,我正处于一个长期自动化的大开发过程中,我不能用<代码> unHeave包装。我希望对上架/卸货进行更精细的控制。也许有一天我们会得到
取消搁置num
,这将取消搁置单个目标。在我的开发中刚刚测试了这一点,取消搁置又创建了约50个无法自动执行的目标。我只想解开其中一个!是的,这是一个相当粗粒度的工具,我并不感到惊讶,因为它可以解压太多东西。
Lemma my_lemma:
  forall a b, Q b -> (Q b -> P a) ->
         exists a (H: P a), P (filter H).
Proof.
  intros ?? H H0.
  do 2 eexists.
  Show Existentials.  
  Restart. (* This command restores the proof editing process to the original goal. *)
  intros ?? H H0.
  assert (HH:P a) by eauto.
  eexists; exists HH.
  auto.
Qed.