1

I am learning the Coq language and trying to prove the following statement:

Lemma ex4: forall (X : Set) (P : X -> Prop), ~(forall x, ~ (P x)) -> (exists x, (P x)).

In the beginning of my proof:

Proof.
  intros X P A.

I arrive at the point where I have the assumptions

X : Set
P : X -> Prop
A : ~ (forall x : X, ~ P x)

I now want to apply de morgan law on A to get an assumption

B : exists x : X, ~ (~ P x) (*** Or something similar ***)

but I can't find a way to correctly use the library function. The following line

apply (not_all_ex_not P).

throws an error:

In environment
X : Set
P : X -> Prop
A : ~ (forall x : X, ~ P x)
The term "P" has type "X -> Prop" while it is expected to have type "Type".

I import the not_all_ex_not from using the command Require Import Coq.Logic.Classical.

What am I doing wrong?

mercury0114
  • 1,341
  • 2
  • 15
  • 29

1 Answers1

1

Use apply not_all_ex_not in A instead (or apply (not_all_ex_not X (fun x => ~ P x)) in A).

Explanation In Coq, you need to explicitly apply type arguments to polymorphic functions and lemmas, unless they are marked as implicit. The not_all_x_not lemma has only explicit arguments, and the first argument is the argument type of the predicate, which is why your attempt did not work. The in A is needed because your goal does not syntactically match the conclusion of not_all_ex_not.

Arthur Azevedo De Amorim
  • 23,012
  • 3
  • 33
  • 39
  • 2
    Or just `apply not_all_ex_not in A.` Note that `not_all_ex_not _ P` is wrong: `A`'s type contains an additional `not` under the quantifier. It would be `not_all_ex_not _ (fun x => ~P x)` if you really wanted to say the property explicitly. – HTNW Jun 09 '20 at 19:36
  • The comment of HTNW worked. The suggestion in the answer does not unify. – mercury0114 Jun 09 '20 at 19:40
  • @mercury0114 Oops! I've updated my answer with HTNW's suggestion. – Arthur Azevedo De Amorim Jun 09 '20 at 19:56