Module FirstTry.
Inductive reflect : Prop -> bool -> Prop :=
| ReflectT : forall (P:Prop), P -> reflect P true
| ReflectF : forall (P:Prop), ~ P -> reflect P false.
(** Before explaining this, let's rearrange it a little: Since the types of both [ReflectT] and [ReflectF] begin with [forall (P:Prop)], we can make the definition a bit more readable and easier to work with by making [P] a parameter of the whole Inductive declaration. *)
End FirstTry.
Inductive reflect (P : Prop) : bool -> Prop :=
| ReflectT : P -> reflect P true
| ReflectF : ~ P -> reflect P false.
(** The [reflect] property takes two arguments: a proposition [P] and a boolean [b].  Intuitively, it states that the property [P] is _reflected_ in (i.e., equivalent to) the boolean [b]: [P] holds if and only if [b = true].  To see this, notice that, by definition, the only way we can produce evidence that [reflect P true] holds is by showing that [P] is true and using the [ReflectT] constructor.  If we invert this statement, this means that it should be possible to extract evidence for [P] from a proof of [reflect P true].  Conversely, the only way to show [reflect P false] is by combining evidence for [~ P] with the [ReflectF] constructor.  It is easy to formalize this intuition and show that the two statements are indeed equivalent: *)
(** The new proof of [filter_not_empty_In] now goes as follows. Notice how the calls to [destruct] and [apply] are combined into a single call to [destruct]. *)
(** (To see this clearly, look at the two proofs of [filter_not_empty_In] with Coq and observe the differences in proof state at the beginning of the first case of the [destruct].) *)

Theorem filter_not_empty_In' : forall n l,
filter (beq_nat n) l <> [] ->
In n l.