The answer to the question you linked to contains this off-hand comment:
The case n=1 is impossible
This is good enough for a human mathematician, but not for Coq. You can tell Coq that you only want to prove cases where n >= 2 by adding that to the premises of the lemma:
Lemma pigeon_hole :
forall m n,
n >= 2 -> (* added this *)
m < n ->
forall f,
(forall i, i < n -> f i < m) ->
exists i, i < n /\
exists j, j < n /\ i <> j /\ f i = f j.
Now this statement should be provable. To get to a state where your induction starts at n = 2, you could argue like this on paper:
By cases on n.
- n = 0: impossible by the precondition n >= 2.
- n = 1: impossible by the precondition n >= 2.
- n >= 2: by induction...
You can do the same in Coq by using destruct on n twice:
Proof.
intros.
destruct n.
We made a case distinction between n = 0 and n >= 0 (i.e., n = S n' for some n'). We are in a proof state with:
H : 0 >= 2
This false hypothesis is exactly the kind of thing that omega can discharge for you:
- omega.
In the other case we know that n >= 1. This is closer to n >= 2 but still not enough, so we can again do a case distinction on n to get rid of the n = 1 case:
- destruct n.
+ omega.
+
The proof state is now:
1 subgoal
m, n : nat
H : S (S n) >= 2
H0 : m < S (S n)
f : nat -> nat
H1 : forall i : nat, i < S (S n) -> f i < m
______________________________________(1/1)
exists i : nat,
i < S (S n) /\ (exists j : nat, j < S (S n) /\ i <> j /\ f i = f j)
So all original uses of n have been replaced by S (S n), i.e., a value that is >= 2.
You should be able to continue from here using induction n.