Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/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中将证明从Z转移到N_Coq_Coq Tactic_Formal Verification - Fatal编程技术网

在Coq中将证明从Z转移到N

在Coq中将证明从Z转移到N,coq,coq-tactic,formal-verification,Coq,Coq Tactic,Formal Verification,在Coq in中有没有一种方法可以证明一个整数语句和一个半自动的自然转换语句 对于混凝土示例,采用以下引理: Lemma cancellation: forall a b c: nat, a > 0 -> a * b = a * c -> b = c. 该语句在Z中实际上是正确的。在这种情况下,更容易证明,因为可以使用减法得到a*b-c=0,然后简化a。但自然减法是有上限的,因此这是行不通的 假设我可以证明这是整数。还有一些策略可以用来推导自然语句吗?一种解决方案是一种称

在Coq in中有没有一种方法可以证明一个整数语句和一个半自动的自然转换语句

对于混凝土示例,采用以下引理:

Lemma cancellation:
  forall a b c: nat, a > 0 -> a * b = a * c -> b = c.
该语句在Z中实际上是正确的。在这种情况下,更容易证明,因为可以使用减法得到a*b-c=0,然后简化a。但自然减法是有上限的,因此这是行不通的


假设我可以证明这是整数。还有一些策略可以用来推导自然语句吗?

一种解决方案是一种称为zify的策略,它自动将操纵自然的目标转换为操纵整数的目标,例如,通过插入对Z.of_nat的适当调用。lia内部称此策略,但似乎没有很好的文档记录。至少有人提到过

在您的情况下,这将给出以下结果

Require Import ZArith.

(* The lemma stated in Z. *)
Lemma cancellation:
  (forall a b c, a > 0 -> a * b = a * c -> b = c)%Z.
Proof.
  (* your favorite proof of this result *)
Admitted.

(* The lemma stated in nat. *)
Lemma cancellation_nat:
  forall a b c: nat, a > 0 -> a * b = a * c -> b = c.
Proof.
  intros.
  zify.
  eauto using cancellation.
Qed.

一种解决方案是一种称为zify的策略,它可以自动将目标操纵自然数转换为目标操纵整数,例如,通过插入对Z.of_nat的适当调用。lia内部称此策略,但似乎没有很好的文档记录。至少有人提到过

在您的情况下,这将给出以下结果

Require Import ZArith.

(* The lemma stated in Z. *)
Lemma cancellation:
  (forall a b c, a > 0 -> a * b = a * c -> b = c)%Z.
Proof.
  (* your favorite proof of this result *)
Admitted.

(* The lemma stated in nat. *)
Lemma cancellation_nat:
  forall a b c: nat, a > 0 -> a * b = a * c -> b = c.
Proof.
  intros.
  zify.
  eauto using cancellation.
Qed.