Section Domain.
Variable Dom : Set.
Inductive tree : Set :=
| leaf : Dom -> tree
| cons : tree -> tree -> tree.
End Domain.
(* Binary trees labeled by natural numbers *)
Definition nat_tree := tree nat.
Definition nat_cons := cons nat.
Definition nat_leaf := leaf nat.
(* Product of all the leaves of some nat_tree *)
Fixpoint leavemult (t : nat_tree) : nat :=
match t return nat with
| leaf n1 =>
(* (nat_leaf n1) *)  n1 (* (nat_cons t1 t2) *)
| cons t1 t2 => leavemult t1 * leavemult t2
end.
(* the specification  of our problem: *)
Definition SPECIF (t : nat_tree) := {n : nat | n = leavemult t}.
(* A (too much) trivial proof *)
intro t.
unfold SPECIF in |- *.
apply exist with (leavemult t); auto.
Defined.
(* Here we  define a predicate "Has an occurrence of O" *)
Fixpoint Has_Zero (t : nat_tree) : Prop :=
match t return Prop with
| leaf n1 =>
(* (nat_leaf n1) *) n1 = 0 (* (nat_cons t1 t2) *)
| cons t1 t2 => Has_Zero t1 \/ Has_Zero t2
end.
(* If some tree t has an occurence of 0, then (leavmult t)=0 *)

Lemma zero_occ : forall t : nat_tree, Has_Zero t -> leavemult t = 0.