intros;destruct a.
inversion H0.
case (in_inv H);intros.
inversion H8;rewrite <- H10;rewrite <- H11;try tauto.
apply IHl;trivial.
Qed.

(* Specifications: *)
(** if (p,n) is in l and (q,m)::l is well-formed then gcd(p,q)=1 *)
Lemma rel_prime_wf : forall (l:list (nat*nat))(p n q m:nat),(In (p,n) l)->(is_wf ((q,m)::l))->(rel_prime p q).
induction l;simpl;intros;try tauto.