[英]Handling forall inside an hypothesis
我剛剛完成了 CS 的博士學位。 現在,我正在學習 coq。 我正在學習Software Foundations課程),這真的很好,我學到了很多東西。 我也開始了一個小項目來使用我學到的所有方法。
我陷入了以下情況: Lemma aux (x: nat): (forall i: nat, True -> i <= x) -> False.
證明它應該很容易,但我無法處理假設中的 forall。 我認為只要說 i = (x+1) 就足夠了,然后我們得到 x+1 <= x,這是錯誤的。 但我不知道該怎么做。
您可以使用specialize
策略實例化假設H: forall i: nat, True -> i <= x
with S x
(這是一種更簡單的寫法x+1
):
(* Goal:
...
H : forall i, True -> i <= x
----------------------------
False
*)
specialize (H (S x)).
(* or, to also get 'True' out of the way: *)
specialize (H (S x) I).
或者,一個更冗長的解決方案,但使用更基本的策略:使用assert
專門的命題,並使用apply
證明它:
intros H. (* H : forall i, True -> i <= x *)
assert (contra : S x <= x).
{ apply H. auto. }
(* Goal:
...
contra : S x <= x
--------------------
False
*)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.