Definition list_remove (x : A) (l : list A) : list A :=
  list_rec (fun _ => list A) nil
    (fun (a : A) _ (recl : list A) =>
     match Aeq_dec a x with
     | left _ => recl
     | right _ => a :: recl
     end) l.

(* Specifications: *)
Lemma In_list_remove1 : forall (a b : A) (l : list A), In a (list_remove b l) -> In a l.
Lemma In_list_remove2 : forall (a b : A) (l : list A), In a (list_remove b l) -> a <> b.
Lemma In_list_remove3 : forall (a b : A) (l : list A), In a l -> a <> b -> In a (list_remove b l).