In the official coq tutorial they define the following inductive definition of less than or equal to:
Inductive le (n : nat) : nat -> Prop :=
          | le_n : le n n
          | le_S : forall m : nat, le n m -> le n (S m).
My understanding of this is that it is defining two type constructors:
le_nwhich takes any natural number and constructs a proof ofle n n.le_Swhich takes any natural numberm, a proof ofle n mand constructs a proof ofle n (S m)
So far so good. However, they then proceed to introduce the following lemma and proof
Lemma tricky : forall n:nat, le n 0 -> n = 0.
Proof.
  intros n0 H.
  inversion H.
  trivial.
Qed.
The 'inversion' step is where I am getting confused. I understand that there is no way to construct le n 0 unless n is equal to 0, since 0 has no successor, but I am not sure at how the inversion tactic figures this out.
To try and understand what it was doing better, I attempted to prove this lemma without using the inversion tactic. However, all of my attempts so far (i.e. using elim on n0, and on H, trying to use the fact that forall n : nat, 0 <> S n., etc.) have failed.
Although my 'Computer science' brain is completely fine with this reasoning, my 'mathematician brain' is having a little bit of trouble accepting this, since there is no hypothesis that this is the only way to construct an inhabitant of le. This made me think that perhaps using the inversion tactic was the only way to do this.
Is it possible to prove this lemma without the inversion tactic? If so, how can it be done?