[英]I'm looking for this lemma about the nat type
我正在尋找有關nat的問題。 我希望它已經存在於Coq庫之一中,所以我不必證明這一點。
forall m n : nat, (S m < n)%nat -> (n - (S m) < n)%nat
請指出我的圖書館是否存在。 謝謝!
該陳述不成立:用m = 0
代替,結論變為n < n
,這是一個明顯的矛盾。
您幾乎在尋找Nat.sub_lt
。 我建議使用“ Search
命令查找引理。 非常強大。
Require Import Arith.
Goal forall m n, (S m < n)%nat -> (n - (S m) < n)%nat.
intros.
Search (_ - _ < _).
apply Nat.sub_lt.
Search (_ < _ -> _ <= _).
apply Nat.lt_le_incl, H.
Search (0 < S _).
apply Nat.lt_0_succ.
Qed.
或auto using Nat.sub_lt, Nat.lt_le_incl, Nat.lt_0_succ.
或auto with arith.
據我所知,沒有Coq庫可以證明您的陳述。 因此,您可以提出自己的證明如下:
Require Import PeanoNat List.
Import Nat.
Goal(forall m n : nat, (S m < n)%nat -> (n - (S m) < n)%nat).
Proof.
induction m.
destruct n.
intros.
inversion H.
intros. simpl.
rewrite Nat.sub_0_r.
apply lt_succ_diag_r.
intros.
intuition.
Qed.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.