Coq 布尔蕴涵的证明策略

Coq 布尔蕴涵的证明策略,coq,coq-tactic,Coq,Coq Tactic,是否有类似于简介的策略来证明布尔蕴涵,例如 f : nat -> bool g : nat -> bool Lemma f_implies_g : forall n : nat, eq_true(implb (f n) (g n)). 这种策略将把eq\u-true(fn)引入上下文,并要求证明eq\u-true(gn)在这种情况下,我建议使用SSReflect。因为它已经有了你需要的机器。它不使用eq\u true将bool嵌入Prop,而是使用is\u true,这是一种替代方

是否有类似于
简介
的策略来证明布尔蕴涵,例如

f : nat -> bool
g : nat -> bool
Lemma f_implies_g : forall n : nat, eq_true(implb (f n) (g n)).

这种策略将把
eq\u-true(fn)
引入上下文,并要求证明
eq\u-true(gn)

在这种情况下,我建议使用SSReflect。因为它已经有了你需要的机器。它不使用
eq\u true
bool
嵌入
Prop
,而是使用
is\u true
,这是一种替代方法

From Coq Require Import ssreflect ssrbool.
Variables f g : nat -> bool.
Lemma f_implies_g n : (f n) ==> (g n).
Proof.
apply/implyP => Hfn.
Abort.
上面的代码片段做了您想要的事情,隐式地将
fn
gn
强制为
Prop
。执行完代码片段后,您会看到

  n : nat
  Hfn : f n
  ============================
  g n
但是
设置打印强制。
显示它确实

  n : nat
  Hfn : is_true (f n)
  ============================
  is_true (g n)

您有的。

谢谢。SSReflect是标准Coq吗?它看起来像是Inria开发的高级库。是的,SSReflect现在是Coq发行版的一部分(即SSReflect、ssrbool和ssrfun模块)。如果您安装mathcomp库(例如,基本部分作为
coq mathcomp ssreflect
OPAM包提供),您可以拥有更多功能--它有ssrnat、seq和path(用于处理列表)以及设计更为完善的库。