I'm reading Mike Nahas's introductory Coq tutorial, which says:
The arguments to "ex_intro" are:
- the predicate
- the witness
- a proof of the predicated called with the witness
I looked at the definition:
Inductive ex (A:Type) (P:A -> Prop) : Prop :=
ex_intro : forall x:A, P x -> ex (A:=A) P.
and I'm having trouble parsing it. Which parts of the expression forall x:A, P x -> ex (A:=A) P
correspond to those three arguments (predicate, witness, and proof)?
To understand what Mike meant, it's better to launch the Coq interpreter and query for the type of ex_intro
:
Check ex_intro.
You should then see:
ex_intro
: forall (A : Type) (P : A -> Prop) (x : A), P x -> exists x, P x
This says that ex_intro
takes not only 3, but 4 arguments:
A
;P : A -> Prop
;x : A
; andP x
, asserting that x
is a valid witness.If you combine all of those things, you get a proof of exists x : A, P x
. For example, @ex_intro nat (fun n => n = 3) 3 eq_refl
is a proof of exists n, n = 3
.
Thus, the difference between the actual type of ex_intro
and the one you read on the definition is that the former includes all of the parameters that are given in the header -- in this case, A
and P
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With