apply (lt_wf_rec a (fun a:nat =>{q : nat &  {r : nat | a = b * q + r /\ r < b}})).
intros.
case (le_lt_dec b n);intro.
elim (H0 (n-b)).
intro q;intro.
elim p;intro r;intro.
exists (q+1);exists r.
split;try tauto.
rewrite (le_plus_minus b n);trivial.
elim p0;intros.
rewrite H1;ring.
omega.
exists 0;exists n.
split;try tauto.
ring.
Qed.
Definition quotient_euclide (a b:nat)(H:(b<>O)) := let (q,_) := (euclide a b H) in q.
Definition remainder_euclide (a b:nat)(H:(b<>O)) := let (_,e0) := (euclide a b H) in let (r,_) := e0 in r.

(* Specifications: *)
(** a div b where b<>0 *)
Lemma quo_rem_euclide : forall (a b:nat)(H:(b<>O)),a=b*(quotient_euclide a b H)+(remainder_euclide a b H).
unfold quotient_euclide;unfold remainder_euclide;intros.