簡體   English   中英

在假設中將〜存在轉換為forall

[英]Convert ~exists to forall in hypothesis

我陷入了我有假設的情況~ (exists k, k <= n+1 /\\ fk = f (n+2))並希望將其轉換為等價(我希望如此)假設forall k, k <= n+1 -> fk <> f (n+2)

這是一個小例子:

Require Import Coq.Logic.Classical_Pred_Type.
Require Import Omega.

Section x.
  Variable n : nat.
  Variable f : nat -> nat.
  Hypothesis Hf : forall i, f i <= n+1.
  Variable i : nat.
  Hypothesis Hi : i <= n+1.
  Hypothesis Hfi: f i = n+1.
  Hypothesis H_nex : ~ (exists k, k <= n+1 /\ f k = f (n+2)).
  Goal (f (n+2) <= n).

我嘗試使用not_ex_all_notCoq.Logic.Classical_Pred_Type

Check not_ex_all_not.
not_ex_all_not
     : forall (U : Type) (P : U -> Prop),
       ~ (exists n : U, P n) -> forall n : U, ~ P n

apply not_ex_all_not in H_nex.
Error: Unable to find an instance for the variable n.

我不明白這個錯誤意味着什么,所以隨機猜測我試過這個:

apply not_ex_all_not with (n := n) in H_nex.

它成功但H_nex現在完全廢話:

H_nex : ~ (n <= n+1 /\ f n = f (n + 2))

另一方面,如果H_nex表示為forall ,很容易解決我的目標:

  Hypothesis H_nex : forall k, k <= n+1 -> f k <> f (n+2).
  specialize (H_nex i).
  specialize (Hf (n+2)).
  omega.

我發現了類似的問題,但未能將其應用於我的案例。

我不太確定你的問題是什么。

以下是如何顯示您的暗示所包含的瑣事。

Section S.

  Variable n : nat.
  Variable f : nat -> nat.
  Hypothesis H : ~ (exists k, k <= n /\ f k = f (n+1)).
  Goal forall k, k <= n -> f k <> f (n+1).
  Proof.
    intros k H1 H2.
    apply H.
    exists k.
    split; assumption.
  Qed.

End S.

apply Hf.也可以證明你的目標apply Hf. ,所以我不確定,但你似乎有些困惑......

如果你想使用not_ex_all_not引理,你想要證明的東西需要看起來像引理。 例如,您可以先證明以下內容:

Lemma lma {n:nat} {f:nat->nat} : ~ (exists k, k <= n /\ f k = f (n+1)) -> 
                                 forall k, ~(k <= n /\ f k = f (n+1)).
  intro H.
  apply not_ex_all_not.
  trivial.
Qed.

然后證明其余的:

Theorem thm (n:nat) (f:nat->nat) : ~ (exists k, k <= n /\ f k = f (n+1)) -> 
                                  forall k, k <= n -> f k <> f (n+1).
  intro P.
  specialize (lma P). intro Q.
  intro k.
  specialize (Q k).
  tauto.
Qed.  

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM