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