通过说如果存在[k]使得[m = k + n],则[m <= n]成立,则对自然数定义关系[&lt; =]。
已经证明了自反性和传递性。reflexive: ref: forall n:nat, n <= n.
transitive: trans: forall l m n:nat, l <= m -> m <= n -> l <= n
现在,如何证明forall l m : nat, l <= m -> m <= l -> m = l
?
答案 0 :(得分:1)
我认为如果有m <= n
k
,那么“n = m + k
就会成立。
我需要证明反对称性的另一个额外因素是:
Lemma le_S_n : forall m n, le (S m) (S n) -> le m n.
然后我的反对称证明就是归纳。这是完整的脚本:
Require Import Arith.
Definition le (m n :nat) := exists k, n = m + k.
Lemma le_refl : forall m, le m m.
Proof.
intro m; exists 0.
now rewrite <- plus_n_O.
Qed.
Lemma le_trans: forall m n p, le m n -> le n p -> le m p.
Proof.
intros m n p [k1 hk1] [k2 hk2]; exists (k1 + k2).
now rewrite plus_assoc, <- hk1.
Qed.
Lemma le_S_n : forall m n, le (S m) (S n) -> le m n.
Proof.
intros m n [k hk]; exists k.
simpl in hk.
now injection hk; intros.
Qed.
Lemma le_antisym: forall m n, le m n -> le n m -> m = n.
Proof.
induction m as [ | m hi]; destruct n as [ | n ]; simpl in *; intros h1 h2.
- reflexivity.
- destruct h2 as [k hk].
simpl in hk; discriminate hk.
- destruct h1 as [k hk].
simpl in hk; discriminate hk.
- now rewrite (hi n); [ reflexivity | apply le_S_n | apply le_S_n ].
Qed.
答案 1 :(得分:1)
这是一个简短的解决方案:
Require Omega.
Definition le (n m:nat) := exists k, n + k = m.
Theorem le_nm_mn_eq: forall n m, le n m -> le m n -> n = m.
Proof.
intros n m Hnm Hmn.
inversion Hnm; inversion Hmn.
omega.
Qed.
它使用欧米茄,因此我不必完全摆脱nat
平等。