Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.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
Functional programming 如何替换假设'0<;d`with`S d';`在Coq?_Functional Programming_Coq - Fatal编程技术网

Functional programming 如何替换假设'0<;d`with`S d';`在Coq?

Functional programming 如何替换假设'0<;d`with`S d';`在Coq?,functional-programming,coq,Functional Programming,Coq,如何用Coq中的sd'替换假设0

如何用Coq中的
sd'
替换假设
0

在Coq中,我有一个恼人的假设,
0
,我需要替换它来应用
euclid\u div\u succu\u定理
来证明
euclid\u div\u定理

我怎样才能把这些假设转换成正确的形式来应用这个定理呢

Theorem euclid_div_theorem :
  forall d : nat,
    0 < d -> 
    forall n : nat,
    exists q r : nat,
      n = q * d + r /\ r < d.

Theorem euclid_div_succ_d_theorem :
  forall d : nat,
  forall n : nat,
  exists q r : nat,
    n = q * (S d) + r /\ r < (S d).
定理欧几里得除法定理:
福尔d:纳特,
0
福尔n:纳特,
存在q r:nat,
n=q*d+r/\r
使用
Arith
模块中的标准引理,您可以将
0
更改为
exists m,d=S m
,这将(在销毁后)提供所需的结果

Require Import Arith.

Theorem euclid_div_theorem : forall d : nat,
    0 < d -> forall n : nat, exists q r : nat, n = q * d + r /\ r < d.
Proof.
  intros d H n.
  apply Nat.lt_neq, Nat.neq_sym, Nat.neq_0_r in H.
  destruct H; rewrite H.
  apply euclid_div_succ_d_theorem.
Qed.
这意味着我们需要从
0
中推断
d0
,因此再次
搜索(
产生:

Nat.lt_neq: forall n m : nat, n < m -> n <> m

谢谢你,安东特鲁诺夫。这是其中一种情况,我知道在纸上做什么,但不能用Coq表达。我感谢你的支持。在证明另一个定理作为推论时,你如何引入一个蕴涵作为假设?我只知道assert。
pose-proof
specialize
类似于
assert
的工作。这取决于您的具体情况,什么最有效(或者完全可以应用)?然而,d可以是任何自然数。我需要用d'替换(sd),并引入d'>0?然而,我不知道如何表达这一点:(一种变体是将
sd
作为一个整体来处理,并通过apply gt\u Sn\u O使用
assert(sd>0)。
Nat.lt_neq: forall n m : nat, n < m -> n <> m
Nat.neq_sym: forall n m : nat, n <> m -> m <> n
not_eq_sym: forall (A : Type) (x y : A), x <> y -> y <> x
  intros d H n.
  destruct d.
  - inversion H.   (* H is a contradiction now: `0 < 0` *)
  - apply euclid_div_succ_d_theorem.